Ryochan7 / sc-controller

User-mode driver and GTK3 based GUI for Steam Controller
GNU General Public License v2.0
177 stars 23 forks source link

Steam Controller over BLE only turns off after another input #59

Closed labsin closed 2 years ago

labsin commented 2 years ago

To reproduce:

If I bind start + Y to turn off the controller like it is standard in steam, you don't need a second input. Works fine when using the dongle.

Ryochan7 commented 2 years ago

I would assume that the routine probably waits until the end of the next gamepad poll before the disconnect occurs. Dealing with the input reports in BLE is pretty funky compared to wired or with the SC dongle. If the mapper is responsible for handling the event with new data then there would likely have to be some physical input change to make sure the mapper input routine runs; I would think gyro input would be enough as long as the controller is not resting on a surface.

I will look into it.

labsin commented 2 years ago

Adding a self._driver.flush() here, fixes it: https://github.com/Ryochan7/sc-controller/blob/868e341402dc18d40d5d3fd5d8d13feed8e69f14/scc/drivers/sc_dongle.py#L385-L390

Ryochan7 commented 2 years ago

Finally got around to looking into this. A flush call is required to have scc actually send the packet to the controller for a BT connection. Without that, scc waits until the next call to the _input method is invoked.

I made the change in commit b5e0572f52119f39b676e2cca1b4f6f1d0bd327d. Although, I chose to override the turnoff method in sc_by_bt.py rather than edit the base SCController turnoff method.

Ryochan7 commented 2 years ago

Got a new release published with the fix. Gave you credit in the release notes. It is probably safe to close this issue now. Thank you for looking into the various BLE support problems.

https://github.com/Ryochan7/sc-controller/releases/tag/v0.4.8.7