Working with the C code of Jim Paris

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

– 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!)

– 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.

Hidemulator Tutorial


This tutorial explains how to control a PS3 with a keyboard and a mouse plugged on a PC running Linux and using a bluetooth dongle.

This is possible thanks to the hidemulator (derived from the work of Jim Paris).

For gaming purposes, I suggest the sixaxis emulator tutorial instead. The hidemulator is not optimized for games.


  • a sixaxis already used with the target PS3
  • a bluetooth dongle with a chip from one of these manufacturers: Ericsson, Cambridge Silicon Radio (CSR), Texas Instruments (TI), Zeevo or ST Microelectronics (ST)

There are cheap (a few $) CSR Bluecore4 dongles on ebay. These dongles will probably work. See that post.


Do it at your own risk. I’m not responsible for any damage you can cause to your PS3 or PC.

The PS3 has to be started using the hidemulator (if hidemulator is stopped, the PS3 has to be shut down and restarted with the hidemulator to get it work again).

Unplug any other dongle from this PC (or deactivate them).

Don’t try to use the hidemulator and the sixaxis at the same time, and restore the bdaddr of the dongle if you don’t use it with hidemulator anymore.

This tutorial was written running ubuntu from the live cd (nothing is saved on the hard drive).

Don’t forget to write down the bdaddr of the PS3 in step 1, so that you won’t need to perform that step again.

Once step 2 is done, you don’t need to do that step anymore since the bdaddr modification is permanent.

As steps 1 & 2 have to be done once, a easy way to launch the hidemulator with a live cd is to write a script for steps 3 & 4.

Feel free to install ubuntu on your PC! If you have a Windows OS installed, you can read this tutorial if you want to install ubuntu on your hard drive without erasing the Windows OS.

1 Discover the bdaddr of the Sixaxis and the bdaddr of the PS3

Plug the sixaxis to the PC with a usb cable

In a terminal (alt+F2, gnome-terminal):

sudo apt-get install libusb-dev


gcc -o sixaddr sixaddr.c -lusb

sudo ./sixaddr

Current Bluetooth master: XX:XX:XX:XX:XX:XX
Current Bluetooth Device Address: YY:YY:YY:YY:YY:YY

“Current Bluetooth master” is the bd_addr of the PS3 (write it down).
“Current Bluetooth Device Address: ” is the bd_addr of the sixaxis (write it down).

Unplug the usb cable. Sixaxis should power off.

2 Modify the bdaddr of the dongle

sudo apt-get install libdbus-1-dev libglib2.0-dev


tar xzvf bluez-4.63.tar.gz

cd bluez-4.63

./configure –enable-test


(do not make install)

cd test


Manufacturer: Cambridge Silicon Radio (10)
Device Address: 01:02:03:04:05:06

Write it down (so that it can be restored).

sudo ./bdaddr ZZ:ZZ:ZZ:ZZ:ZZ:ZZ

(replace the ZZ:ZZ:ZZ:ZZ:ZZ:ZZ with the bdaddr of the Sixaxis dicovered in step 1).

Unplug and replug the dongle.


Manufacturer: Cambridge Silicon Radio (10)
Device Address: ZZ:ZZ:ZZ:ZZ:ZZ:ZZ

Make sure the bdaddr has been changed.

3 Install python libraries

Note for users that don’t run ubuntu from the live cd: uninstall older versions of PyBluez and Pygame.

sudo apt-get install python2.6-dev libbluetooth-dev libsdl1.2-dev

cd ~


tar xzvf PyBluez-0.18.tar.gz

cd PyBluez-0.18

sudo python install

cd ~


tar xzvf pygame-1.9.1release.tar.gz

cd pygame-1.9.1release

sudo python

4 Run the hidemulator

cd ~

sudo apt-get install subversion

svn checkout hidemulator-read-only

cd hidemulator-read-only

chmod +x


Line 28, insert the bd_addr of the PS3 (discovered in step 1) between the quotes.

Make sure the PS3 is powered off.


The PS3 should power on!!!

To quit the hidemulator, just press Escape.

Note that the PS3 has to be started using the hidemulator.

I am a Sixaxis, I am a Sixaxis, I am a…

I managed to control my PS3 from my PC, with the method described at

It only works with one of the 3 dongle I tested.

All are able to power up the PS3, but connection is aborted with the 2 dongles that can’t have their bluetooth device address changed permanently.

From my desktop pc that is located in another room, I pressed space key (cross button) to select the user, and right and left keys to navigate in the menu 🙂

Next step: install a linux distro on a laptop so as to make intensive tests in front of my PS3.

PC as Sixaxis joystick – tests

On a Linux PC, I tried to modify the bluetooth device address of some dongles:

– COM1 – broadcom chip – modification ok, but not persistent
– Linyx – ISSC chip – modification ok, but not persistent
– Cellink – CSR chip – modification ok & persistent

“Persistent” means that the modification is permanent, even after unplugging the dongle. These results are consistent with infos given there.

I didn’t found out a way to modify this address in Windows (temporarily or permanently).

I discovered that pybluez requires the widcomm bluetooth stack to work with l2cap in Windows. ISSC and CSR chips are not supported (anymore) by the widcomm stack. Only my COM1 dongle can work with the widcomm bluetooth stack (property of broadcom company).

As a result I can’t use any of these dongles with my hcpc (which runs Windows 7). I could install Linux on it, but I have a TV scheduler installed, so that it would not be possible to control the PS3 and record a TV show at the same time 🙁

I have to find another bluetooth dongle, whose bdaddr can be permanently modified, and that works with widcomm stack…

Meanwhile, I will try the hidemulator with another PC running Linux.

PC as Sixaxis joystick

Asking google about the “sixaxis report frequency”, I got the answer on that forum page (seems to be down, but it is still in google cache: page1 page2) on which it is said that there is about 10ms between reports. That matches the mouse frequency in my project (100Hz), so that if the PS3 does not take more than 100 reports per second (to be tested), there is no need to increase it (ps/2 mouse maximum frequency is 200Hz).

This information is less interesting than the forum page itself. It is about using a PC to emulate a sixaxis via Bluetooth! Using a bluetooth dongle, the PC connects to the PS3 using the sixaxis’s bluetooth device address. As I have a hcpc near my PS3, and want to use the same wireless keyboard+mouse to control both, I will definitely give it a try!


hidemulator googlecode from Brandon (python code)
source code from Jim Paris (C code)
how to change bluetooth device mac address (Linux)

hidemulator should work with both Linux & Windows (to be tested).

Software to install:
python 2.6

pygame is used to get input events from mouse and keyboard. Joysticks could be used too.

I think pygame events are get from the OS (mixing all input devices: ps/2, hid…), and therefore may have been modified (accelerated mouse movements). It would probably be better to get raw data from the hid device. This can be done thanks to libhid that supports python.

Project now works with bumble-b too!

bumble-b is a mini usb developpement kit with at90usb162 microcontroller. It has a low price – 15$ – and price is digressive if you buy 5 (14$) or 10 units (13$).

The project now works on that board thanks to small updates of the code:
– port D is used instead of port E, which does not exist with at90usb162
– the mouse is reset (=initialized) in the main function, as a last initialization step (avoids a deadlock which seems to occur more with at90usb162 than at90usb1286)

The only modification that remains to build the project for the bumble-b is located in the Makefile: the MCU value has to be set to “at90usb162”.