由 USB 3.0 设备导致的暂停状态立即唤醒

由 USB 3.0 设备导致的暂停状态立即唤醒

我的电脑通常可以正常挂起和唤醒。但是当我连接 USB3.0 硬盘时,即使已卸载并断开连接,每次尝试挂起时机器都会立即唤醒。

(如下)中所有 USB 设备均被禁用/proc/acpi/wakeup,并且我看不到/var/log/syslog与 USB 磁盘或待机或唤醒过程有关的任何错误。

同一块磁盘连接到 USB 2.0 端口不会引起同样的问题,USB 2.0 磁盘连接到 USB 3.0 端口也不会引起同样的问题。即使没有连接任何 USB 设备,如果自启动以来曾经连接过 USB 3.0 磁盘,计算机也会立即从待机状态唤醒。

该系统是 Dell Precision M6700,问题出现在 14.04 版本中,并且仍然存在于 14.10 版本中。

这可能是什么原因造成的?我该如何进一步调试?

> cat /proc/acpi/wakeup
Device  S-state   Status   Sysfs node
P0P1      S4    *disabled
USB1      S3    *disabled
USB2      S3    *disabled
USB3      S3    *disabled
USB5      S3    *disabled
USB6      S3    *disabled
USB7      S3    *disabled
RP01      S4    *disabled  pci:0000:00:1c.0
PXSX      S4    *disabled
RP02      S4    *disabled  pci:0000:00:1c.1
PXSX      S4    *disabled  pci:0000:03:00.0
RP05      S4    *disabled
PXSX      S4    *disabled
RP06      S4    *disabled
PXSX      S4    *disabled
RP07      S4    *disabled
PXSX      S4    *disabled
RP08      S4    *disabled  pci:0000:00:1c.7
PXSX      S4    *disabled  pci:0000:0c:00.0
PEG0      S4    *disabled  pci:0000:00:01.0
PEGP      S4    *disabled
PEG1      S4    *disabled
PEG2      S4    *disabled
PEG3      S4    *disabled
USB4      S3    *disabled
RP03      S4    *disabled  pci:0000:00:1c.2
RP04      S4    *disabled  pci:0000:00:1c.3
PXSX      S4    *disabled
GLAN      S4    *enabled   pci:0000:00:19.0
EHC1      S0    *enabled   pci:0000:00:1d.0
EHC2      S0    *enabled   pci:0000:00:1a.0
XHC       S0    *enabled   pci:0000:00:14.0
HDEF      S4    *disabled  pci:0000:00:1b.0
LID0      S3    *enabled 
PBTN      S3    *enabled

编辑-明确禁用设备并不能解决问题

我现在尝试禁用所有设备(电源按钮除外)的唤醒功能。

首先我禁用了设备,/proc/acpi/wakeup然后确保搜索了/sys/devices/所有wakeup文件:

find /sys/devices/ -name "wakeup" -print -exec grep enabled {} \;

然后我明确地将它们全部设置为disabled,例如:

sudo bash -c "echo disabled > /sys/devices/pci0000:00/0000:00:19.0/power/wakeup"

仅保留电源按钮启用状态:

cat /sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup
# enabled

此后,计算机仍会立即从挂起状态唤醒(只要连接了 USB 3.0 磁盘)。

此外,唤醒后,以下设备已重置为enabled

/sys/devices/pci0000:00/0000:00:19.0/power/wakeup
/sys/devices/LNXSYSTM:00/device:00/PNP0C0A:00/power_supply/BAT0/power/wakeup

PCI 设备似乎是我的 LAN,因为它也在以下位置重置/proc/acpi/wakeup

Device  S-state   Status   Sysfs node
...
GLAN      S4    *enabled   pci:0000:00:19.0
...

是否还存在设备中未列出的其他负责唤醒的因素?

编辑-添加了详细的 lsusb 信息

已添加请求的信息法比

> Bus 004 Device 002: ID 357d:7788  
> Device Descriptor:
>   bLength                18
>   bDescriptorType         1
>   bcdUSB               3.00
>   bDeviceClass            0 (Defined at Interface level)
>   bDeviceSubClass         0 
>   bDeviceProtocol         0 
>   bMaxPacketSize0         9
>   idVendor           0x357d 
>   idProduct          0x7788 
>   bcdDevice            0.00
>   iManufacturer          10 
>   iProduct               11 
>   iSerial                 3 
>   bNumConfigurations      1
>   Configuration Descriptor:
>     bLength                 9
>     bDescriptorType         2
>     wTotalLength          121
>     bNumInterfaces          1
>     bConfigurationValue     1
>     iConfiguration          0 
>     bmAttributes         0xc0
>       Self Powered
>     MaxPower                2mA
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       0
>       bNumEndpoints           2
>       bInterfaceClass         8 Mass Storage
>       bInterfaceSubClass      6 SCSI
>       bInterfaceProtocol     80 Bulk-Only
>       iInterface              0 
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x81  EP 1 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0400  1x 1024 bytes
>         bInterval               0
>         bMaxBurst              15
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x02  EP 2 OUT
>     Couldn't open device, some information will be missing
>     bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0400  1x 1024 bytes
>         bInterval               0
>         bMaxBurst              15
>     Interface Descriptor:
>       bLength                 9
>       bDescriptorType         4
>       bInterfaceNumber        0
>       bAlternateSetting       1
>       bNumEndpoints           4
>       bInterfaceClass         8 Mass Storage
>       bInterfaceSubClass      6 SCSI
>       bInterfaceProtocol     98 
>       iInterface              0 
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x01  EP 1 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0400  1x 1024 bytes
>         bInterval               0
>         bMaxBurst               0
>         Command pipe (0x01)
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x82  EP 2 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0400  1x 1024 bytes
>         bInterval               0
>         bMaxBurst               0
>         MaxStreams             32
>         Status pipe (0x02)
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x83  EP 3 IN
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0400  1x 1024 bytes
>         bInterval               0
>         bMaxBurst              15
>         MaxStreams             32
>         Data-in pipe (0x03)
>       Endpoint Descriptor:
>         bLength                 7
>         bDescriptorType         5
>         bEndpointAddress     0x04  EP 4 OUT
>         bmAttributes            2
>           Transfer Type            Bulk
>           Synch Type               None
>           Usage Type               Data
>         wMaxPacketSize     0x0400  1x 1024 bytes
>         bInterval               0
>         bMaxBurst              15
>         MaxStreams             32
>         Data-out pipe (0x04)
> 

答案1

首先,我不清楚输出XHC中列出的wakeup是 USB 3.0 设备。

XHC       S0    *enabled   pci:0000:00:14.0

然而,即使禁用该设备的唤醒状态也无法解决问题。

sudo bash -c "echo disabled > \
    /sys/devices/pci0000:00/0000:00:14.0/power/wakeup"  # Problem persists.

我发现的唯一可行的解​​决方案是使用以下命令来unbind运行设备驱动程序:bind

sudo bash -c ' \
  echo -n "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/unbind && \
  echo -n "0000:00:14.0" > /sys/bus/pci/drivers/xhci_hcd/bind;'

每次连接 USB 3.0 存储设备和挂起计算机之间我都必须这样做,但它始终有效。

需要注意的是,xhci_hcd路径的组成部分仅对 USB 3.0 设备有效。路径的这一部分需要根据需要重置的总线类型而变化,可能是 之一uhci_hcdsdhci-pci或者ehci-pci对于其他类型的存储设备。

答案2

抱歉,我想添加答案,但我的声誉不足以添加评论......

(即我为什么要看你的问题!);-):P

您是否尝试过重置暂停之前刚刚断开磁盘连接的 USB 总线?

如果你不知道如何做,你可以:

  1. 关闭机器
  2. 拔下所有 USB 设备
  3. 拔掉所有电源线、UPS、电池……
  4. 打开机器电源(是的:没有电源线!)
  5. 重新接回步骤 3 中切断的所有电源
  6. 启动机器
  7. 做一个:lsusb --verbose > /tmp/good-bus.txt 2>&1
  8. 插入磁盘
  9. 做一个:lsusb --verbose > /tmp/bad-bus.txt 2>&1
  10. 卸载磁盘
  11. 弹出磁盘
  12. 移除磁盘
  13. 做一个:lsusb --verbose > /tmp/worse-bus.txt 2>&1
  14. 做一个:diff --text /tmp/good-bus.txt /tmp/bad-bus.txt > /tmp/test-g-b.txt
  15. 做一个:diff --text /tmp/good-bus.txt /tmp/worse-bus.txt > /tmp/test-g-w.txt

然后在这里报告 /tmp/test-gb.txt 和 /tmp/test-gw.txt 的输出

相关内容