You are not logged in.

#1 2015-10-21 10:26:47

Aliverix
Member
Registered: 2014-11-05
Posts: 10

USB 3.0 device always triggers wakeup

Hi everyone,

On my notebook, an Asus N550JV, suspension works correctly most of the times but, when I plug a USB 3.0 device in the USB port on the right side, my computer is no longer able to suspend. In that case, the suspension process is executed correctly but, once completed, the notebook wakes up immediately, even if the lid is closed.

My notebook has three USB 3.0 ports, two on the left side and one on the right side. If I use the ports on the left side everything works normally, the problem is only present with the right side port. I've tried also with USB 2.0 devices but in that case everything works fine. I want to remark that, when I connect, and than disconnect, the device to, and from, that port, the notebook is not able to suspend until the next reboot of the system, even if there isn't a USB device attached during the suspension process.

After triggering the problem, with a connection and a disconnection of a USB 3.0 device on the right port, I managed to make my notebook suspend correctly again changing the wakeup triggers in /proc/acpi/wakeup; in particular I disabled EHC1, EHC2 and XHC triggers. Obviously this change does not survive a reboot. (You have to disable all three of them at the same time, otherwise the problem is still present)

I suspect that the problem is related with the xhci_hcd module, so I posted in the kernel section.

I don't know for how long the problem has been there, it is something quite difficult to isolate and notice. Now I'm using the "linux" package, thus kernel "4.2.3-1", but the problem is still present with the "linux-lts" package, thus kernel "4.1.10-2".

Offline

#2 2015-10-29 14:42:09

9233
Member
Registered: 2015-02-01
Posts: 34

Re: USB 3.0 device always triggers wakeup

This exact issue has been bugging me me for months!
It only happens with my WD external hard drive on one specific USB 3.0 port though.
I managed to reproduce it while running "dmesg -w" and this is what I got:

[   14.804088] fuse init (API version 7.23)
[   36.445636] usb 4-2: new SuperSpeed USB device number 2 using xhci_hcd
[   36.987416] usb-storage 4-2:1.0: USB Mass Storage device detected
[   36.987580] scsi host5: usb-storage 4-2:1.0
[   36.987923] usbcore: registered new interface driver usb-storage
[   36.989021] usbcore: registered new interface driver uas
[   37.991551] scsi 5:0:0:0: Direct-Access     WD       Elements 10A8    1042 PQ: 0 ANSI: 6
[   37.992623] sd 5:0:0:0: [sdb] Spinning up disk...
[   38.995093] .....ready
[   43.204826] sd 5:0:0:0: [sdb] 1953458176 512-byte logical blocks: (1.00 TB/931 GiB)
[   43.205078] sd 5:0:0:0: [sdb] Write Protect is off
[   43.205081] sd 5:0:0:0: [sdb] Mode Sense: 53 00 10 08
[   43.205268] sd 5:0:0:0: [sdb] No Caching mode page found
[   43.205270] sd 5:0:0:0: [sdb] Assuming drive cache: write through
[   43.216284]  sdb: sdb1 sdb2 sdb3
[   43.217150] sd 5:0:0:0: [sdb] Attached SCSI disk
[   51.650998] usb 4-2: USB disconnect, device number 2
[   59.622661] PM: Syncing filesystems ... done.
[   59.634500] PM: Preparing system for sleep (mem)
[   59.634826] Freezing user space processes ... (elapsed 0.001 seconds) done.
[   59.636149] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[   59.637257] PM: Suspending system (mem)
[   59.637276] Suspending console(s) (use no_console_suspend to debug)
[   59.637533] sd 4:0:0:0: [sda] Synchronizing SCSI cache
[   59.639892] sd 4:0:0:0: [sda] Stopping disk
[   60.665566] PM: suspend of devices complete after 1027.034 msecs
[   60.682192] PM: late suspend of devices complete after 16.604 msecs
[   60.682875] ehci-pci 0000:00:1d.0: System wakeup enabled by ACPI
[   60.683258] ehci-pci 0000:00:1a.0: System wakeup enabled by ACPI
[   60.683272] xhci_hcd 0000:00:14.0: System wakeup enabled by ACPI
[   60.695595] PM: noirq suspend of devices complete after 13.386 msecs
[   60.695872] ACPI: Preparing to enter system sleep state S3
[   60.702337] ACPI : EC: EC stopped
[   60.702337] PM: Saving platform NVS memory
[   60.702342] Disabling non-boot CPUs ...
[   60.703584] smpboot: CPU 1 is now offline
[   60.705075] smpboot: CPU 2 is now offline
[   60.706560] smpboot: CPU 3 is now offline
[   60.708024] smpboot: CPU 4 is now offline
[   60.709473] smpboot: CPU 5 is now offline
[   60.710854] smpboot: CPU 6 is now offline
[   60.712288] smpboot: CPU 7 is now offline
[   60.713688] ACPI: Low-level resume complete
[   60.713726] ACPI : EC: EC started
[   60.713726] PM: Restoring platform NVS memory
[   60.715999] microcode: CPU0 microcode updated early to revision 0x1c, date = 2014-07-03
[   60.716087] Enabling non-boot CPUs ...
[   60.716130] x86: Booting SMP configuration:
[   60.716131] smpboot: Booting Node 0 Processor 1 APIC 0x1
[   60.720386]  cache: parent cpu1 should not be sleeping
[   60.720501] CPU1 is up
[   60.720522] smpboot: Booting Node 0 Processor 2 APIC 0x2
[   60.722637] microcode: CPU2 microcode updated early to revision 0x1c, date = 2014-07-03
[   60.725871]  cache: parent cpu2 should not be sleeping
[   60.725984] CPU2 is up
[   60.726008] smpboot: Booting Node 0 Processor 3 APIC 0x3
[   60.730274]  cache: parent cpu3 should not be sleeping
[   60.730390] CPU3 is up
[   60.730410] smpboot: Booting Node 0 Processor 4 APIC 0x4
[   60.732524] microcode: CPU4 microcode updated early to revision 0x1c, date = 2014-07-03
[   60.735773]  cache: parent cpu4 should not be sleeping
[   60.735885] CPU4 is up
[   60.735907] smpboot: Booting Node 0 Processor 5 APIC 0x5
[   60.740189]  cache: parent cpu5 should not be sleeping
[   60.740306] CPU5 is up
[   60.740331] smpboot: Booting Node 0 Processor 6 APIC 0x6
[   60.742451] microcode: CPU6 microcode updated early to revision 0x1c, date = 2014-07-03
[   60.745713]  cache: parent cpu6 should not be sleeping
[   60.745836] CPU6 is up
[   60.745862] smpboot: Booting Node 0 Processor 7 APIC 0x7
[   60.750172]  cache: parent cpu7 should not be sleeping
[   60.750294] CPU7 is up
[   60.757464] ACPI: Waking up from system sleep state S3
[   60.759225] ehci-pci 0000:00:1d.0: System wakeup disabled by ACPI
[   60.759237] xhci_hcd 0000:00:14.0: System wakeup disabled by ACPI
[   60.759307] ehci-pci 0000:00:1a.0: System wakeup disabled by ACPI
[   60.770213] PM: noirq resume of devices complete after 12.191 msecs
[   60.770521] PM: early resume of devices complete after 0.291 msecs
[   60.770762] r8169 0000:03:00.0: System wakeup disabled by ACPI
[   60.774760] sd 4:0:0:0: [sda] Starting disk
[   60.781468] r8169 0000:03:00.0 enp3s0: link down
[   60.877115] rtc_cmos 00:02: System wakeup disabled by ACPI
[   61.036277] usb 3-6: reset high-speed USB device number 2 using xhci_hcd
[   61.092817] ata5: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[   61.110601] ata5.00: configured for UDMA/133
[   61.197138] psmouse serio1: synaptics: queried max coordinates: x [..5664], y [..4678]
[   61.226421] psmouse serio1: synaptics: queried min coordinates: x [1278..], y [1228..]
[   61.273553] PM: resume of devices complete after 502.477 msecs
[   61.273694] PM: Finishing wakeup.
[   61.273695] Restarting tasks ... done.

My exact steps on a freshly booted system were:

  1. Plug in the drive, waiting until it spins up

  2. Disconnect the drive

  3. try to suspend (it wakes up immediately

Would be great if someone knows how to fix this.

Offline

#3 2015-11-02 19:11:57

9233
Member
Registered: 2015-02-01
Posts: 34

Re: USB 3.0 device always triggers wakeup

I found a pretty simple solution for this.
As Aliverix described, changing the wakeup triggers  in /proc/acpi/wakeup works.
However this settings are only temporary so I wrote a systemd unit file to make these settings at startup:

/etc/systemd/system/disable-USB-wakeup.service

[Unit]
Description=Disable USB wakeup triggers in /proc/acpi/wakeup

[Service]
Type=oneshot
ExecStart=/bin/sh -c "echo EHC1 > /proc/acpi/wakeup; echo EHC2 > /proc/acpi/wakeup; echo XHC > /proc/acpi/wakeup"
ExecStop=/bin/sh -c "echo EHC1 > /proc/acpi/wakeup; echo EHC2 > /proc/acpi/wakeup; echo XHC > /proc/acpi/wakeup"
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target

Then simply enable and start it:

sudo systemctl enable disable-USB-wakeup.service
sudo systemctl start disable-USB-wakeup.service

Since changes to /proc/acpi/wakeup are toggled and afaik can not be explicitly set, I made shure to run the same command on "ExecStop" so that restarting the service doesn't result in the wakeup triggers being enabled again.

Offline

#4 2016-05-06 12:05:39

Bernie99
Member
Registered: 2016-05-06
Posts: 1

Re: USB 3.0 device always triggers wakeup

Of course, the triggers can be explicitly enabled or disabled by first checking the current status.
An example script to do this would be e.g.:

---- disable_acpi_wakeup.sh

#! /usr/bin/sh
# Add your candidates below but make sure that no pattern matches more than one device in /proc/acpi/wakeup
CANDIDATES="EHC1 EHC2 XHC"
for ACPIDEV in $CANDIDATES; do
ACTIVE=$(grep enabled /proc/acpi/wakeup | cut -f 1 | grep "$ACPIDEV")
  if [ -n "$ACTIVE" ]; then 
    echo "$ACTIVE" > /proc/acpi/wakeup
    echo "DEBUG: disabled -$ACTIVE-" >&2
  else
    echo "DEBUG: no active -$ACPIDEV- found." >&2
  fi
done

I have similar issues with a Lenovo ThinkPad Yoga S1, on which only the XHC trigger exists, and causes wakeup issues. I have no EHC1/2.

I know UNIX but am a newbie to Arch (actually the Manjaro spinoff; I hope the forum tolerates).
Therefore I am not sure where the script above would be best placed to run with each startup.

Any idea?

Offline

#5 2016-06-16 02:07:38

Nikus
Member
Registered: 2012-12-10
Posts: 10

Re: USB 3.0 device always triggers wakeup

@Bernie99, scripts for systemd may be placed in /usr/lib/systemd/scripts

Offline

Board footer

Powered by FluxBB