从 USB 3.0 设备引起的挂起中立即唤醒

Ian*_*non 6 usb suspend 14.10

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

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

连接到 USB 2.0 端口的同一个磁盘不会导致相同的问题,连接到 USB 3.0 端口的 USB 2.0 磁盘也不会导致相同的问题。如果在启动后连接过 USB 3.0 磁盘,即使根本没有连接 USB 设备,计算机也会立即从待机状态唤醒。

系统是 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
Run Code Online (Sandbox Code Playgroud)

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

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

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

find /sys/devices/ -name "wakeup" -print -exec grep enabled {} \;
Run Code Online (Sandbox Code Playgroud)

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

sudo bash -c "echo disabled > /sys/devices/pci0000:00/0000:00:19.0/power/wakeup"
Run Code Online (Sandbox Code Playgroud)

仅启用电源按钮:

cat /sys/devices/LNXSYSTM:00/LNXPWRBN:00/power/wakeup
# enabled
Run Code Online (Sandbox Code Playgroud)

之后,计算机仍会立即从挂起状态中唤醒(只要连接过 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
Run Code Online (Sandbox Code Playgroud)

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

Device  S-state   Status   Sysfs node
...
GLAN      S4    *enabled   pci:0000:00:19.0
...
Run Code Online (Sandbox Code Playgroud)

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

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

添加了Fabby要求的信息

> 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)
> 
Run Code Online (Sandbox Code Playgroud)

Ian*_*non 3

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

XHC       S0    *enabled   pci:0000:00:14.0
Run Code Online (Sandbox Code Playgroud)

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

sudo bash -c "echo disabled > \
    /sys/devices/pci0000:00/0000:00:14.0/power/wakeup"  # Problem persists.
Run Code Online (Sandbox Code Playgroud)

我发现的唯一可行的解​​决方案是使用以下命令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;'
Run Code Online (Sandbox Code Playgroud)

每次连接 USB 3.0 存储设备和挂起计算机之间我都必须执行此操作,但它始终可以正常工作。

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