-
Notifications
You must be signed in to change notification settings - Fork 41
Description
A friend of mine recently asked me about an issue with their GPD Win Max 2 (Ryzen 6800U) running Bazzite. When pressing the power button, the device would attempt to suspend, then about half the time wake back up immediately.
After much testing of enabling/disabling different settings, it became clear that the gamepad emulation option in HHD was causing the issue. The issue appears only when enabling controller emulation, on any emulated controller (xbox, steam controller).
Looking through the logs of hhd at the time of suspend (sudo journalctl -f -u hhd), the following can be seen:
Journalctl output snippet
...
Nov 04 19:10:50 GrandpaDeck hhd[1274]: OSError: [Errno 19] No such device
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW INFO Launching emulated controller.
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW INFO Gamepadui closed. Disabling touchpad emulation.
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW INFO Found device 'i2c-10EC5280:00' at
Nov 04 19:10:50 GrandpaDeck hhd[1274]: /sys/bus/iio/devices/iio:device0
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW INFO Found device 'i2c-10EC5280:00' at
Nov 04 19:10:50 GrandpaDeck hhd[1274]: /sys/bus/iio/devices/iio:device0
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW WARNING Using cached controller node for Steamdeck Controller.
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW INFO Starting 'Steam Controller (HHD)'.
Nov 04 19:10:50 GrandpaDeck hhd[1274]: GPDW INFO Emulated controller launched, have fun!
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW WARNING Caching Steam Controller to avoid reconnection.
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW ERROR Assuming controllers disconnected, restarting after 0.3s.
Nov 04 19:11:08 GrandpaDeck hhd[1274]: Traceback (most recent call last):
Nov 04 19:11:08 GrandpaDeck hhd[1274]: File
Nov 04 19:11:08 GrandpaDeck hhd[1274]: "/usr/lib/python3.13/site-packages/hhd/device/gpd/win/base.py",
Nov 04 19:11:08 GrandpaDeck hhd[1274]: line 183, in plugin_run
Nov 04 19:11:08 GrandpaDeck hhd[1274]: controller_loop(conf.copy(), should_exit, updated, dconf,
Nov 04 19:11:08 GrandpaDeck hhd[1274]: emit)
Nov 04 19:11:08 GrandpaDeck hhd[1274]: ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Nov 04 19:11:08 GrandpaDeck hhd[1274]: ^^^
Nov 04 19:11:08 GrandpaDeck hhd[1274]: File
Nov 04 19:11:08 GrandpaDeck hhd[1274]: "/usr/lib/python3.13/site-packages/hhd/device/gpd/win/base.py",
Nov 04 19:11:08 GrandpaDeck hhd[1274]: line 383, in controller_loop
Nov 04 19:11:08 GrandpaDeck hhd[1274]: evs.extend(d.produce(r))
Nov 04 19:11:08 GrandpaDeck hhd[1274]: ~~~~~~~~~^^^
Nov 04 19:11:08 GrandpaDeck hhd[1274]: File
Nov 04 19:11:08 GrandpaDeck hhd[1274]: "/usr/lib/python3.13/site-packages/hhd/controller/physical/evdev
Nov 04 19:11:08 GrandpaDeck hhd[1274]: .py", line 433, in produce
Nov 04 19:11:08 GrandpaDeck hhd[1274]: for e in self.dev.read():
Nov 04 19:11:08 GrandpaDeck hhd[1274]: ~~~~~~~~~~~~~^^
Nov 04 19:11:08 GrandpaDeck hhd[1274]: File "/usr/lib64/python3.13/site-packages/evdev/eventio.py",
Nov 04 19:11:08 GrandpaDeck hhd[1274]: line 71, in read
Nov 04 19:11:08 GrandpaDeck hhd[1274]: events = _input.device_read_many(self.fd)
Nov 04 19:11:08 GrandpaDeck hhd[1274]: OSError: [Errno 19] No such device
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW INFO Launching emulated controller.
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW INFO Gamepadui closed. Disabling touchpad emulation.
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW INFO Found device 'i2c-10EC5280:00' at
Nov 04 19:11:08 GrandpaDeck hhd[1274]: /sys/bus/iio/devices/iio:device0
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW INFO Found device 'i2c-10EC5280:00' at
Nov 04 19:11:08 GrandpaDeck hhd[1274]: /sys/bus/iio/devices/iio:device0
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW WARNING Using cached controller node for Steamdeck Controller.
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW INFO Starting 'Steam Controller (HHD)'.
Nov 04 19:11:08 GrandpaDeck hhd[1274]: GPDW INFO Emulated controller launched, have fun!
...
The suspend in the above logs was attempted at 19:11:07, after which hhd immediately sees the physical controller as disconnected (which makes sense, as the handheld is suspending USB devices). HHD tries to re-initiate the virtual controller, which somehow cancels the suspend, causing the device to wake up again.
Another friend with an ROG Ally Z1 Extreme running Arch Linux also tested this, with the exact same issue (though I do not have logs from them). Turning off controller emulation resolves it, turning it back on causes suspend to fail randomly.
I'm unsure of the potential fix to this, it would likely involve detecting when the system wants to suspend, then waiting to run controller_loop in device/{model}/base.py until the system has fully resumed.