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.
I finally found a compatible
, low price, worldwide available bluetooth dongle. The brand name is “Pluscom”, it’s quite unknown, and the model name is “BT-20”. The chip inside this dongle is a CSR Bluecore4-rom, and what’s even more surprising is that it’s written “CSR BC4” on the product package.
This dongle is available on ebay: link. The price is good and the seller is in the UK, which should provide a faster delivery than China to people living in the EU or the US. No longer available 🙁
The shape of this dongle is exactly the same than my Peabird PEAB-BT-SM04C-100M (CSR Bluecore4-rom). It’s not a very common shape for bluetooth dongles, so that I think it’s highly possible that these dongles come from the same factory.
The whole series of posts about cheap ebay dongles: link.
It seems ebay is really not a good option to find a CSR bluecore4 dongle. As a reminder, these dongles can have their bdaddr (bluetooth device address) changed, and 99% of them work with the sixaxis emulator. As far as I remember, only 1 or 2 users reported a non-working CSR BC4 dongle.
After having tried 2 sellers and only having received 2 out of 7 non-fake dongles, I decided to try another seller. But this time, I asked before buying, so as to make sure I will get what I am paying for. The answer to my question “Is there really a CSR BC4 chip inside your dongles?” was a clear “YES”. Fine, I decided to buy 5.
After 3 weeks I finally received my order. First test, plug it to my PC, see what kind of bluecore revision it is. No revision, not good at all. Try to change the bdaddr. No error for the command, but the bdaddr is not changed. Finally, unplug it, open it, and look at the chip manufacturer: Conwise. Obviously not CSR…
Lesson learnt: don’t buy these cheap ebay dongles, even if it’s advertised as a BC4 (CSR+EDR) dongle!
A good advice I could give is to borrow every dongle you can borrow, and test it. Last solution: get a dongle from a local store.
It seems some bt dongles out there are CSR counterfeits.
I suspect most of the cheap CSR-advertised ebay dongles of being CSR counterfeits.
These dongles are advertised as CSR dongles supporting EDR, which means they should contain a CSR bluecore4 chip.
But in fact they contain an ASC (Accel semiconductor) chip named AS3620QA.
What makes them counterfeits:
- they all have the same bluetooth address! This means several of these dongles can’t be used in the same area. If you and your neighbor are using the same dongle at the same time, it won’t work, or it will work with many connection errors.
- they are using the CSR usb vendor id (0x0A12)
What’s even worst for us is that these dongles can’t have their bdaddr changed!
A photo of all my working dongles:
From left to right: Trust (CSR bluecore4-rom), “cheap ebay dongle” (CSR bluecore4-rom), Fujistsu-Siemens FMWBA-101 (CSR bluecore2-ext es2), Com1 (Broadcom), Peabird (CSR bluecore4-rom), Cellink BTA-3000 (CSR bluecore2-ext), and Linksys USBBT100 (CSR bluecore2-ext).
All connected to a Belkin usb hub:
I can get all these dongles working simultaneously with the sixaxis emulator, which means I can emulate 7 sixaxis controllers at the same time 😉
I was thinking the Bluecore4-ROM dongles can’t have their bdaddrs (bluetooth device address) changed… I was wrong! Curiously, these dongles seem to have some writable non-volatile memory!
I bought 4 Bluecore4-ROM dongles on ebay – 3$ each – about a month ago, and thought at the beginning they wouldn’t work.
But some people told me that the bdaddr of their Bluecore4-ROM bluetooth dongle can be modified permanently…
I finally received them, and as expected, I got their bdaddr changed permanently 🙂
The only bad thing is that 2 of the 4 dongles I received are not, as advertised, CSR dongles with Bluetooth 2.0+EDR (i.e. Bluecore4 dongles). One seems to be an old bluecore1 dongle (its bdaddr can’t be changed), and another one seems to be a counterfeit (it has the CSR product and vendor ids, but it does not contain a CSR chip) and doesn’t work at all.
EDIT August 4: Sellers usually don’t tell which CSR chip is inside a bluetooth dongle. The key point is that bluecore4 implements bluetooth 2.0+EDR. Therefore, a dongle advertised as a CSR dongle with bluetooth 2.0+EDR should contain a bluecore4 chip (or newer). Be careful, it seems some sellers are retailing old bluecore1 dongles as CSR dongles with bluetooth 2.0+EDR. Bluecore1 chips can’t have their bdaddr changed!
The final sixpair-emu firmware for the Teensy++ is available there.
I wrote a small python app that makes the customization of the sixpair-emu easier: nothing to compile, no firmware to download (except the pre-compiled initial one) to the Teensy++!
It looks like this:
- use it at your own risk
- the (vendor id, product id) = (0x054c, 0x0268) is the property of Sony
- plug the Teensy++ to the PC
- download the firmware to the Teensy++ with the Teensy loader
- if the bluetooth device to be used is a dongle, then plug it to the PC (if external)
- launch the sixpair-emu customizer
- select the Teensy++
- select the bluetooth device, or select and edit custom bdaddr
- select the (vendor id – product id): sixaxis = 0x054c – 0x0268, original firmware = 0x03eb – 0x2042
- clic apply (if there is no change, the application tells nothing was modified)
- unplug the Teensy++
- plug it to the PS3
=> the bluetooth device is registered as a Sixaxis by the PS3, so that it can connect to the PS3 as a sixaxis!
If a Teensy++ or a bluetooth device is plugged after the application is started, the refresh button allows to refresh the gui without restart.
Python code is available there.
It requires following packages:
- python 2.6.5
- libusb > 1.0
- pyusb > 1.0
- pybluez 0.18
It has to be launched in a terminal with the following command:
sudo python sixp-emu-cust.py
(tested in windows vista)
– python 2.6.5 (includes python-tk)
– libusb filter driver 220.127.116.11
– pyusb 1.0.0-a0 (to be installed in cmd shell with ‘setup.py install’)
– pybluez 0.18
(the bdaddrs are not read, but custom bdaddr can be set)