立即從 USB 3.0 裝置引起的暫停中喚醒

立即從 USB 3.0 裝置引起的暫停中喚醒

我的電腦通常會正常掛起和喚醒。但是當我連接USB3.0硬碟時,即使已卸載並斷開連接,每次嘗試暫停時機器都會立即喚醒。

所有 USB 裝置均在(如下)中停用/proc/acpi/wakeup,並且我看不到/var/log/syslog與 USB 磁碟或待機或喚醒過程相關的任何錯誤。

連接到 USB 2.0 連接埠的相同磁碟不會導致相同的問題,連接到 USB 3.0 連接埠的 USB 2.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-pciehci-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 的輸出

相關內容