tolga9009 / sidewinderd

Linux support for Microsoft SideWinder X4 / X6 and Logitech G103 / G105 / G710+.

Home Page:http://cevel.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sidewinderd fails on resume from suspend

dkumor opened this issue · comments

I am on a fully-updated archlinux with a logitech G710+ keyboard. Everything works perfectly on boot, but when the computer is resumed after being suspended with systemctl suspend, the keyboard's extra functionality is no longer active (none of the macro lights are on either). After restarting sidewinderd.service, everything goes back to working.

I have included the output of journalctl -u sidewinderd.service -b, but it doesn't look like there is anything special there - it simply shows the service starting Aug 15, and being restarted manually on Aug 18:

Command output
Aug 15 22:31:34 maestro systemd[1]: Started Support for Microsoft SideWinder X4 / X6 and Logitech G105 / G710+.
Aug 15 22:31:34 maestro sidewinderd[996]: Started sidewinderd.
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Keyboard Constructor
Aug 15 22:31:35 maestro sidewinderd[996]: getFeatureReport(6) returned: 6 0
Aug 15 22:31:35 maestro sidewinderd[996]: getFeatureReport(6) returned: 6 0
Aug 15 22:31:35 maestro sidewinderd[996]: getFeatureReport(6) returned: 6 0
Aug 15 22:31:35 maestro sidewinderd[996]: getFeatureReport(6) returned: 6 0
Aug 15 22:31:35 maestro sidewinderd[996]: getFeatureReport(6) returned: 6 0
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:35 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 15 22:31:36 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 16 00:35:38 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 16 00:35:39 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 16 00:35:39 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 16 00:35:39 maestro sidewinderd[996]: Found device: 046d:c24d
Aug 18 22:47:39 maestro sidewinderd[996]: Stop signal received.
Aug 18 22:47:39 maestro sidewinderd[996]: Stopped sidewinderd.
Aug 18 22:47:39 maestro sidewinderd[996]: LogitechG710 Destructor
Aug 18 22:47:39 maestro systemd[1]: Stopping Support for Microsoft SideWinder X4 / X6 and Logitech G105 / G710+...
Aug 18 22:47:43 maestro sidewinderd[996]: Keyboard Destructor
Aug 18 22:47:43 maestro systemd[1]: sidewinderd.service: Succeeded.
Aug 18 22:47:43 maestro systemd[1]: Stopped Support for Microsoft SideWinder X4 / X6 and Logitech G105 / G710+.
Aug 18 22:47:43 maestro systemd[1]: Started Support for Microsoft SideWinder X4 / X6 and Logitech G105 / G710+.
Aug 18 22:47:43 maestro sidewinderd[1733460]: Started sidewinderd.
Aug 18 22:47:43 maestro sidewinderd[1733460]: Found device: 046d:c24d
Aug 18 22:47:43 maestro sidewinderd[1733460]: Keyboard Constructor
Aug 18 22:47:43 maestro sidewinderd[1733460]: getFeatureReport(6) returned: 6 0
Aug 18 22:47:43 maestro sidewinderd[1733460]: getFeatureReport(6) returned: 6 0
Aug 18 22:47:43 maestro sidewinderd[1733460]: getFeatureReport(6) returned: 6 0
Aug 18 22:47:43 maestro sidewinderd[1733460]: getFeatureReport(6) returned: 6 0
Aug 18 22:47:43 maestro sidewinderd[1733460]: getFeatureReport(6) returned: 6 0
Aug 18 22:47:43 maestro sidewinderd[1733460]: Found device: 046d:c24d
Aug 18 22:47:43 maestro sidewinderd[1733460]: Found device: 046d:c24d

Hi,

thank you for the bug report!

Sounds very plausable to me, atleast for certain keyboards. Logitech G710+ needs a "Magic Packet" for initial setup, which we probably don't send after a resume. We also probably need to sync the internal representation with actual hardware after resume. Luckily, I have a G710+ somewhere around to reproduce the bug and further investigate it. Unfortunately, I don't have time to look into this until Sunday. I'll come back here, after reproducing the bug.

Cheers,
Tolga

I was able to successfully reproduce the bug. Keyboard blinks a few times after resume from suspend, macro keys are not lit. However, as soon as I push any macro key (w/ assigned keystrokes), it "semi" works. Macro is replayed correctly, but G-Keys additionally emit numbers, like in unconfigured state. Also pushing any of the M1 - M3 keys makes the LED work again. I don't need to restart sidewinderd in my case.

The other keyboard I've tested (Microsoft SideWinder X4) didn't have this issue. I guess it affects only certain (Logitech) keyboards. I need to further investigate this and make sure, it's really caused by hardware. Also, I'm curious how Logitech handles these situations under Windows.

I've never worked on resume / suspend specific code, I need to further read on this. Luckily, it doesn't sound like a serious crash. It's more like a hardware-reset and therefore a kinda "out-of-sync" situation. My plan would be: recognize we're waking up from resume, re-run parts of the configuration code (LogitechG710::resetMacroKeys()) and re-sync hardware with sidewinderd using HidInterface::setReport(). This should bring the LEDs back up and make the G-Keys fully functional again.

I think we could apply re-syncing after resume via HidInterface::setReport() to all keyboards aswell. Shouldn't have any drawbacks.

Thanks for looking into this! Your results mirror my experience here. For now I am restarting the service on resume, but I will happily debug/test any possible patches!