-
Notifications
You must be signed in to change notification settings - Fork 41
Enable Gyro on Demand to Save Battery Life #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Since the controller is cached between runs, can you just make it crash the controller and when it restarts disable gyro in |
|
this is so you do not touch every device driver. You can keep a bool in the handheld controller so you can check it in get_outputs to see if you should enable gyro |
I got it. It's really simpler but I still meet some problems:
Do you have any good idea? |
Add a function to hhd/src/hhd/plugins/outputs.py Lines 144 to 157 in 1968199
See above.
Make the option be always on. After you make the changes, I will give it a go and see. I kind of see what you mean. |
|
You are right... restarting the controller takes too long |
|
We need to make sure we change as few lines as possible on the common code parts, because its always dangerous |
I agree. |
|
Instead of disabling the imu, make Because I am afraid the fast enable and disable are just going to break the kernel |
That's reasonable. I'll do that tomorrow, because it's midnight at my time zone. :) |
|
I've taken a look into it. Lowest sampling frequency may be still pretty high. Apart from that, I've tested that open and close IMU device frequently is actually OK. Also, we may adopt debounce to avoid too high frequency. Supplementary Real output: $ cat /sys/bus/iio/devices/iio:device0/in_accel_sampling_frequency_available
0.78125 1.5625 3.125 6.25 12.5 25 50 100 200 400 800 1600
$ cat /sys/bus/iio/devices/iio:device0/in_anglvel_sampling_frequency_available
25 50 100 200 400 800 1600 3200 |
|
I still recommend the original solution. Even if it cause something broken, there's an toggle to turn off this feature. |
|
BTW, I found that QAM shortcut (Xbox+A) doesn't work in Steam Controller with Handheld Mode. Is there any reason? |
|
Check this out. I did it two days ago I think. It does not work well. But I think the approach of passing an event through from the controller to the imu has merit. It decreases the change to the driver code to two lines and does not require doing the crash. I tried changing the frequency, and that worked very badly. So that's where you can help |
Sounds great! I took a deeper look into HHD, and now I have a better understanding of its event logic. I'll go ahead. |
|
As far as I know, the IMU device, and even the whole controller loop, doesn't act as an event consumer, so the common event cannot be passed into it. |
|
I'm sure you will be satisfied with this method. :) |
Yes we need to add 2 lines for imu to consume. But that's ok. I tested it and the event passthrough works. But turning down the frequency didnt |
I've tested that completely restarting controller takes about 0.1s, which is totally acceptable. IMO, throwing IMU into event loop is kind of ... complicated? In my latest commit, I continue using the restart method, but trigger it by making change on config. I think it's simpler and more elegant. Please check it out. |
|
I was testing restarts and on the Ayaneo 3 it takes a bit longer which ends up freezing input so it's not possible to navigate the calibration panel |
|
OK, I'll switch to event method. |
|
Emm, here I'm facing a new problem. The controller |
|
The controller is always at least 25hz. This is so consumers don't break while reading the controller and for deferred events to fire correctly. So I don't see a need to turn off the gyro completely if it's easier |
|
5-10 Hz shouldn't affect utilization much |
|
Oh, it seems that I misunderstood your words.
I thought you meant that turning down the frequency worked bad so won't use it. Just code doesn't work well? Or any other problem? Apart from that, I still have some hope to use the method that completely turns off IMU. Because it performs best, while a little latency doesn't affect much. There's many other way to get into calibrate panel, like touchscreen or even turning off the on-demand feature. And most of the user will meet this latency only when they open a gyro-enabled game, where they still need to wait for the game loading, and no gamepad action is needed. |
|
Sorry for the ambiguity. Yes, my code did not work well. If it's possible it would be great. Could even go down to 2hz. The only nonideal part is that the imu stops being available for screen rotation |
|
I removed all Apart from that, I made it default to enable IMU power save on start, and disable gyro sync when IMU is in power save mode. |
|
Kindly remind this pr. |
|
I am very busy currently. Let me circle back in a few days. Feel free to remind me if i don't |
|
Maybe we can push this pr :) |
|
Now that I versioned V4, I am about to do a lot of breaking changes so it is a good opportunity to. I also made it so Bazzite testing builds using the master branch so these changes can be tested without affecting broader users. Can you rebase it? |
|
It seems that there is no conflict in it. Fast forward is ok. |
|
this will be nice as I never use gyro lol |
Method
Steam Controller with Handheld Mode uses
uhidto emulate controller, and there is anUHID_SET_REPORTevent that carrying a steam setting namedSETTING_STABILIZER_ENABLED, which signals whether gyro is using. I capture this event and trigger an IMU toggle callback.Unfortunately, I only found Steam Controller with Handheld Mode has this kind of action, so it will not work at Dualsense or other modes.
It is a Proof of Concept, and ONLY tested on my GPD Win Mini 2024.
Comparison
Here is an experiment on my GPD Win Mini 2024 with few apps in background and only 2 cores enabled. Checking power consumption and CPU usage through
btop.With
Enable Gyro on DemandPower: 7.85W, CPU Usage: 1.5% (HHD only)
Without
Enable Gyro on DemandPower: 9.69W, CPU Usage: 4.1% (HHD) + 4.6% (IRQ from IMU)
Tested on GPD Win Mini 2024 (R7-8840U)