Note that some Bluetooth dongles don't work properly with these drivers. I'm using a cheap CSR-chip-based dongle. Info from http://booting-rpi.blogspot.ro/2012/08/dualshock-3-and-raspberry-pi.html .
$ sudo apt-get update; sudo apt-get upgrade
$ sudo apt-get install bluez-utils bluez-compat bluez-hcidump checkinstall libusb-dev libbluetooth-dev joystick
$ hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 00:15:83:CE:A5:7C ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING PSCAN RX bytes:1489 acl:0 sco:0 events:74 errors:0 TX bytes:1276 acl:0 sco:0 commands:73 errors:0
$ mkdir sixaxis ; cd sixaxis ; wget http://www.pabr.org/sixlinux/sixpair.c ; gcc -o sixpair sixpair.c -lusb
$ sudo ./sixpair Current Bluetooth master: 78:dd:08:11:3c:9c Setting master bd_addr to 00:15:83:ce:a5:7c
$ wget http://sourceforge.net/projects/qtsixa/files/QtSixA%201.5.1/QtSixA-1.5.1-src.tar.gz $ tar -xzvf QtSixA-1.5.1-src.tar.gz $ cd QtSixA-1.5.1/sixad $ make $ sudo mkdir -p /var/lib/sixad/profiles $ sudo checkinstall
$sudo sixad --start sixad-bin[6851]: started sixad-bin[6851]: sixad started, press the PS button now sixad-bin[6851]: unable to connect to sdp session sixad-bin[6851]: Connected Sony Computer Entertainment Wireless Controller (04:76:6E:4C:06:F8)
$ sudo update-rc.d sixad defaults $ sudo reboot
$ sudo jstest /dev/input/js0