暂停后 USB 端口不可用

暂停后 USB 端口不可用

我的问题是,在我的笔记本电脑上安装 Ubuntu 12.04 后,挂起功能不起作用。通过本次培训,我解决了挂起问题。但是从挂起状态恢复后,我的 USB 端口变得不可用。

答案1

有一个比重建内核更简单的解决方案http://ubuntuforums.org/showthread.php?t=1460790 我只需要在我的华硕 N53SV 上解除绑定/绑定

答案2

谢谢,这有帮助。

对我来说,我必须 a) 解除 USB 设备的绑定,以及 b) 手动关闭 wifi。

如果有人发现它有用,这里有一个):

root@tosh:~# cat /etc/pm/sleep.d/20_usb_suspend_fix

#!/bin/sh

LOGTAG=PwrUsbFix
UNDO=/var/run/pm-utils/pm-suspend/storage/rebind_usb.sh

# check am root
[ "$(id -u)" = 0 ] || {
    echo "$LOGTAG : must be run as root!"
    exit 1
    }

case "${1}" in
    hibernate|suspend)
        : > ${UNDO}
        find /sys/bus/pci/drivers -maxdepth 2 -path \*\[eu\]hci\* -name unbind | cut -d\/ -f -6 | \
            while read BUS ; do 
                find ${BUS} -maxdepth 1 -type l -name 00\* | \
                    while read DEVPATH ; do
                        DEVICE=`basename $DEVPATH`
                        echo "$LOGTAG : echo ${DEVICE} > ${BUS}/unbind"
                        echo -n "${DEVICE}" > ${BUS}/unbind
                        echo "echo \"${LOGTAG} ${DEVICE} > ${BUS}/bind\"" >> ${UNDO}
                        echo "echo -n \"${DEVICE}\" > ${BUS}/bind" >> ${UNDO}
                    done
            done
    ;;
    resume|thaw)
        . ${UNDO}
    ;;
esac

exit 0

和 b)

root@tosh# cat /etc/pm/sleep.d/30_wifi_off

#! /bin/sh

MODULES="ath9k ath9k_common ath9k_hw ath"

case "${1}" in
        hibernate|suspend)
              # Switch wireless off
              nmcli nm sleep true
              rfkill block 0
              rmmod ${MODULES}
        ;;
        resume|thaw)
              # Switch wireless on
              modprobe ${MODULES}
              rfkill unblock 0
              nmcli nm sleep false
        ;;
esac

最后——系统信息..

http://www.toshiba.co.uk/discontinued-products/satellite-pro-p300-28e/

root@tosh:~# uname -a
Linux tosh 3.13.0-31-generic #55~precise2-Ubuntu SMP Wed Jul 2 17:02:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

root@tosh:~# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 12.04.5 LTS
Release:    12.04
Codename:    precise

答案3

我遇到了类似的问题。经过一周的搜索,我发现了问题所在。在 Ubuntu 内核中,USB 驱动程序是内置的。因此,在挂起和恢复时,驱动程序无法卸载然后作为模块重新加载。所以我不得不从源代码编译 Linux 内核,并确保 USB 驱动程序(xhci_hcdehci_hcd)被设为可加载模块。

从那里,我创建了一个名为的20_custom-ehci_hcd文件/etc/pm/sleep.d/

#!/bin/sh
# Inspired by http://art.ubuntuforums.org/showpost.php?p=9744970&postcount=19
#...and http://thecodecentral.com/2011/01/18/fix-ubuntu-10-10-suspendhibernate-not-working-bug
# Tidied by tqzzaa :)
VERSION=1.1
DEV_LIST=/tmp/usb-dev-list
DRIVERS_DIR=/sys/bus/pci/drivers
DRIVERS="ehci xhci" # ehci_hcd, xhci_hcd
HEX="[[:xdigit:]]"
MAX_BIND_ATTEMPTS=2
BIND_WAIT=0.1
unbindDev() {
  echo -n > $DEV_LIST 2>/dev/null
  for driver in $DRIVERS; do
    DDIR=$DRIVERS_DIR/${driver}_hcd
    for dev in `ls $DDIR 2>/dev/null | egrep "^$HEX+:$HEX+:$HEX"`; do
      echo -n "$dev" > $DDIR/unbind
      echo "$driver $dev" >> $DEV_LIST
    done
  done
}
bindDev() {
  if [ -s $DEV_LIST ]; then
    while read driver dev; do
      DDIR=$DRIVERS_DIR/${driver}_hcd
    while [ $((MAX_BIND_ATTEMPTS)) -gt 0 ]; do
      echo -n "$dev" > $DDIR/bind
      if [ ! -L "$DDIR/$dev" ]; then
        sleep $BIND_WAIT
      else
        break
      fi
      MAX_BIND_ATTEMPTS=$((MAX_BIND_ATTEMPTS-1))
    done
  done fi
  rm $DEV_LIST 2>/dev/null
}
case "$1" in
  hibernate|suspend) unbindDev;;
  resume|thaw) bindDev;;
esac

希望这对你有用。我可能在某个地方创建了另一个文件,但我现在找不到它。

我找到了另一个文件。在 中/etc/pm/config.d/,我创建了一个名为 的文件modules

模块

SUSPEND_MODULES="xhci ehci_hcd xhci_hcd xhci-hcd ehci-hcd"

相关内容