jfernandez / ControllerTools

Game controller plugin for the Steam Deck
GNU General Public License v3.0
49 stars 3 forks source link

Implement support for Sony DualShock 3 #41

Closed nicolas0p closed 2 months ago

nicolas0p commented 10 months ago

Implement support for the Sony DualShock 3 controller.

This implementation was based on the linux driver for this controller and tested manually using both Bluetooth connection and USB cable.

The DS3 reports battery capacity in a odd way. It actually only reports 7 possible values: 0, 1, 25, 50, 75, 100% battery capacity, charging-not-full or charging-full. So I had to choose which value of battery capacity when it reports charging-not-full. I opted for 75% so the user wouldn't think the battery is full when it is not. But this leads to a funny situation:

I tried to follow all code conventions, but I may have failed.

Please point out errors and improvements I could make to the code.

All tests were done using a DualShock 3 model CECHZC2U. I can adapt the code to other similar models if needed, however, I don't have other DS3 controllers. I don't think there are major differences, at least according to the linux driver.

Hope we can get this code merged, I think it would help a few users. It was a fun little project.