GPD Gyro woes after sleep

@justinweiss @Aru let's get a discussion going about the gyro sleep issue in gpd Observed on GPD 4 2023, 2024, and Win Max (?) across all kernels and OSs (Nix, chimeraos, bazzite)
36 Replies
Aru
Aru•9mo ago
on my WM2 (6800u) the gyro doesn't work. but for the GPD Win 4, the gyro workaround is required for the 6800u, 7840u, and 8840u models
antheas
antheasOP•9mo ago
what does that mean
Aru
Aru•9mo ago
I confirmed the issue on my 6800u, I helped a different user with a 7840u, and then there's the 8840u report steam input doesn't show gyro working
antheas
antheasOP•9mo ago
what gyro does it have?
Aru
Aru•9mo ago
it never actually worked on my WM2, even with an updated bazzite
antheas
antheasOP•9mo ago
could have said something, although i think it might be a 160 and bazzite doesnt ship the patch
Aru
Aru•9mo ago
err, not sure. i had assumed it was the same as the win 4, but never investigated it i don't really use my WM2 for gaming, so I never investigated i just turned off gyro and ignored it
antheas
antheasOP•9mo ago
yeah gpd users are not my n1 customer
Aru
Aru•9mo ago
the gyro workaround worked fine on my Win 4, figured that it was a low-priority issue and wouldn't be investigated anytime soon
antheas
antheasOP•9mo ago
yeah but now we're getting a lot more gpd users it seems
Aru
Aru•9mo ago
i had brought up the idea of implementing the workaround as a ujust
antheas
antheasOP•9mo ago
lets fix the driver make sure you can reproduce it on a fresh boot without hhd running then we can move on from there as you know from the suspend issue the ally/legion go had that workaround is dangerous
Aru
Aru•9mo ago
how would i test the gyro without hhd running?
antheas
antheasOP•9mo ago
start it after you suspend once or twice it only matters its not running until after the suspend
Aru
Aru•9mo ago
ah gotcha, so disable, reboot, suspend a few times, then start hhd and see if it's broken but bazzite restarts the hhd service on boot 🤔
antheas
antheasOP•9mo ago
disable it, does the setup reenable it every reboot?
Aru
Aru•9mo ago
this was the problem before with local hhd bazzite always started the built-in hhd service, even when disabled
antheas
antheasOP•9mo ago
i thought it did it occasionally
Aru
Aru•9mo ago
for me it was every time
antheas
antheasOP•9mo ago
anyway its ok, just shut it down before suspend please save me from dbus
Aru
Aru•9mo ago
usually hhd_local would kick in before the built-in hhd would take control, but if I ever disabled the hhd_local, the built-in would take over which confused me a lot when i had previously been troubleshooting running off local hhd - disabled hhd service, disabled workaround, did a reboot - on reboot, as expected, hhd service was re-enabled. Disabled the service again, then did 2 suspend-resume cycles - afterwards, turned hhd service back on. gyro was borked - re-enabled the gyro workaround, then did a suspend-resume cycle - after resume, gyro now working fine in steam input
antheas
antheasOP•9mo ago
gyro workaround is eh lets see if we can stop relying on it
Aru
Aru•9mo ago
it's basically just a rmmod and modprobe on suspend-resume
antheas
antheasOP•9mo ago
so gyro just breaks after suspend
Aru
Aru•9mo ago
hopefully we could figure out the actual problem pretty much
antheas
antheasOP•9mo ago
probably needs a reset after suspend
Aru
Aru•9mo ago
if i have hhd running, on fresh boot gyro works fine it breaks after suspend
justinweiss
justinweiss•9mo ago
easiest way to see if gyro is sending data is watch cat /sys/bus/iio/devices/iio\:device0/in_accel_x_raw (assuming device0 is right on the Win 4)
antheas
antheasOP•9mo ago
There's a chance that only the buffer breaks but let's see I might have a command for that too
justinweiss
justinweiss•9mo ago
I haven't been able to cause the problem on the Win Mini unfortunately, so there must be some difference. I was wondering if it was IRQ vs hrtimer triggers, but when I tried forcing hrtimer a while back I also don't remember seeing the problem. That's the first thing I'll try again once I have some time though. What does dmesg say? With hrtimer I wonder if it's trying to access the hardware / bus before it's ready. But that code isn't any different than the 160 IIRC so I'd expect the same problem there. Haven't heard of any problems with that one though.
antheas
antheasOP•9mo ago
Here's the thing We shut down hhd before the tes6 And it removes the trigger Unfortunately we can't make 100% sure it doesn't mess with something else I guess we can disable gyro before roboot 160 hasn't been tested Only 323 Unfortunately nobody ships the 160 patch Dmesg complains if the hrtimer is on But you've probably seen the error yoo
justinweiss
justinweiss•9mo ago
Well, if it's a crash in the module it would be best if the module could recover without forcing the software to handle it That's this error? https://github.com/justinweiss/bmi260/blob/main/bmi260_core.c#L747
antheas
antheasOP•9mo ago
No there's an interruption stack trace Due to the hrtimer The 323 recovers and your device recovers too right? As for irq, that is fixed with hrtimer
justinweiss
justinweiss•9mo ago
nothing needs to recover for me, I don't get a stack trace. But the mini is also using IRQ triggers.
antheas
antheasOP•9mo ago
Yes the stacktrace only happens with hrtimer I knew about it from the beginning But since the devices recovered I thought it was fine I can botch a fix but I'd rather not So I need to make sure its not hrtimer
justinweiss
justinweiss•9mo ago
yeah, I think that watch command with hhd disabled would help figure that out. If the gyro stops reporting data after a suspend when a trigger has never been set up, it's probably not related to hrtimer if it's fine when you read the data raw, it's probably a buffer problem or hrtimer problem or a timing problem, something like that On the mini, I tried a version of the driver that doesn't set up an IRQ. Reading the raw gyro data still works after a suspend, but I can't get hhd to start with that hacked up driver, just get this in a loop:
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Launching emulated controller.
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Gamepadui active. Launching touchpad emulation.
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Found device 2f24:0135:
Apr 16 17:48:43 chimeraos hhd[204527]: ' ': 'Mouse for Windows' at b'/dev/hidraw1'
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Found device 'i2c-BMI0160:00' at
Apr 16 17:48:43 chimeraos hhd[204527]: /sys/bus/iio/devices/iio:device0
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW ERROR Received the following error:
Apr 16 17:48:43 chimeraos hhd[204527]: <class 'OSError'>: [Errno 22] Invalid argument
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW ERROR Assuming controllers disconnected, restarting after 3s.
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Launching emulated controller.
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Gamepadui active. Launching touchpad emulation.
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Found device 2f24:0135:
Apr 16 17:48:43 chimeraos hhd[204527]: ' ': 'Mouse for Windows' at b'/dev/hidraw1'
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW INFO Found device 'i2c-BMI0160:00' at
Apr 16 17:48:43 chimeraos hhd[204527]: /sys/bus/iio/devices/iio:device0
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW ERROR Received the following error:
Apr 16 17:48:43 chimeraos hhd[204527]: <class 'OSError'>: [Errno 22] Invalid argument
Apr 16 17:48:43 chimeraos hhd[204527]: GPDW ERROR Assuming controllers disconnected, restarting after 3s.
I'm still curious whether reading the raw data from sysfs will work on the win 4 after a suspend / resume
Want results from more Discord servers?
Add your server