As the PS4 only supports bluetooth controls, I decided to work on the latency issues that occur when controlling a PS3 over bluetooth with GIMX:
- Latency when using a slim/superslim PS3 and GIMX in Ubuntu 12.04+.
- Latency when using a bluetooth headset or several controllers at the same time.
As I only had a fat PS3, I had to get a slim PS3. I bought one with a defective blu-ray lens for 60€ (about 80$).
I discovered several problems:
- A change in the Linux 3.1 kernel: the bluetooth transmitter was forced to go into the active mode instead of remaining in the sniff mode.
- Bluetooth packets not properly synced: the IN report has to be sent immediately after receiving the OUT report.
These problems are both related to the bluetooth sniff mode, which is used to reduce the power consumption.
To simplify, each device in the piconet is active during a fixed window:
X+0 - the master sends a packet to slave 1 X+1 - slave 1 sends a packet to the master and reduces its power till its Tsniff period is over (11250µs) X+2 - the master sends a packet to slave 2 X+3 - slave 2 sends a packet to the master and reduces its power till its Tsniff period is over (11250µs) ... X+18 - the master sends a packet to slave 1 ...
The master sends OUT reports, and the slaves IN reports.
If an IN report is not sent at the right time, it gets retransmitted later.
If the IN report period is slightly lower than the OUT report period, the IN reports will be gradually buffered, thus generating a latency that slowly increases.
The current GIMX design can’t guarantee that the IN reports are sent in the right slot, because the OS can interrupt the program and schedule another task.
The following improvements could be made:
- Merge emu and emuclient: this would prevent the kernel from interrupting emu to run emuclient (this can happen just after receiving an OUT report and before sending the IN report…). This would improve GIMX performances especially on single core CPUs (like the Raspberry Pi). This would still not ensure a 100% perfect sync, but I believe this is the only possible improvement without adding extra hardware.
- Handle the Bluetooth protocol with a DIY adapter: PC —USB— AVR USB —UART— BT module —BT— PS3.