After having tested the hidemulator python code, I decided to go further with the C code of Jim Paris.
This code produces two executable files:
– a server, that interfaces with the PS3, and that maintains the bluetooth connection
– a client, that interfaces with peripherals thanks to the SDL library, and that sends controls to the server
Pros:
– no need to interrupt the bluetooth connection when exiting the client => no need to restart the PS3 => easier to test
– no need to install python libraries
– better performance of C code over python
– client/server architecture allows developing other clients (imagine a mobile phone client!)
Cons:
– less portable than python code
– I already have strong C code knowledge, so that I’m not learning something new 😉
I did the following modifications to the server:
– send a report immediately after receiving a command from a client
– send a report if no command was received during 1 second
And to the client:
– poll for events each 10ms, and merge all received events (a single command is sent to the PS3)
– grab raw input from the mouse (i.e. relative position), and constrain the mouse into the window
– custom controls for mouse and keyboard (to play fps games)
– on-the-fly modifiable multiplier for mouse movements (to increase/decrease sensibility)
Remaining work:
– scroll up/down generates two events (SDL_MOUSEBUTTONDOWN & SDL_MOUSEBUTTONUP) that should not be merged
– write a tutorial
– …
– integration testing = play! 😉
Code is available there.