mercredi 15 juin 2011

HOW-TO Setup PS3 BD Remote

http://www.mythtv.org/wiki/Sony_PS3_BD_Remote
http://wiki.xbmc.org/?title=HOW-TO_Setup_PS3_BD_Remote


Installation

BlueZ

Note: Newer versions of bluez have been released which appear to have this patch already. I didn't need to patch 4.63 to get BD working on ubuntu 10.04
Note: Kitlaan now has patches up to Bluez-4.69, and the patch is required for 4.64 - 4.69
The latest versions of the patch are available at: http://kitlaan.twinaxis.com/projects/bluez-ps3remote/
sudo apt-get purge bluez
cd /usr/local/src
wget http://kitlaan.twinaxis.com/holdingcell/bluez_ps3remote.diff
wget http://www.kernel.org/pub/linux/bluetooth/bluez-4.58.tar.gz
tar xvfz bluez-4.58.tar.gz
cd bluez-4.58
patch -p0 < ../bluez_ps3remote.diff
./configure
make
sudo checkinstall --fstrans=no --install=yes --pkgname=bluez --pkgversion "4.58-patched"
Or, using kitlaan's PPA:
sudo apt-get purge bluez
sudo echo deb http://ppa.launchpad.net/kitlaan/ppa/ubuntu jaunty main >> /etc/apt/sources.list
sudo echo deb-src http://ppa.launchpad.net/kitlaan/ppa/ubuntu jaunty main >> /etc/apt/sources.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 6F7177CC
sudo apt-get update
sudo apt-get install bluez
Of course, replace "jaunty" with the name of your distribution.

Kernel module

Check if the uinput module is running:
lsmod | grep uinput
If that's not the case:
sudo modprobe uinput
echo uinput >> /etc/modules

Pairing

Please note that the pairing script requires that the dbus-python and pygobject python modules are installed. They are normally installed on a default 9.04 Jaunty. (If you need them added, apt-get install python-dbus and python-gobject.)
cd ~
wget http://kitlaan.twinaxis.com/projects/bluez-ps3remote/ps3pair.tar.gz
tar xvfz ps3pair.tar.gz
cd ~/ps3pair
sudo python ps3_pair.py
Now press START+Enter on your PS3 remote for at least 7 seconds, then it should detect the remote. Then run
/usr/share/doc/bluez/examples/list-devices
to verify that the remote is paired (and connected). If list-devices is not installed into /usr/share, check the bluez source tree, it should be in there. Also, running
cat /proc/bus/input/devices | grep emot
should show the remote. If it does not show up, you may not have the uinput module loaded.
Then customize the file "/etc/bluetooth/input.conf" for button mappings and timeout values (Example here). At this point, the remote should connect (and auto-disconnect after a timeout, if configured). The d-pad is probably the best way to test it within xbmc. If you have a terminal active, pressing the number buttons should type the number.
Note: - The pairing scripts are not required by some distro's - just install Blueman and setup your BD remote as an input service and trust the device - this way you dont explicitly need to pair the device - it simply becomes a keyboard extension. The input.conf below will take care of key mapping.

Example input.conf

A more advanced bluetooth input.conf is probably lurking in the depths of this thread, however here's an example to get you started. The first thing you'll need to change in this is your BD Remote's hardware address (i.e. change 00:1E:3D:B6:12:7E to your remote's address)
# input.conf - kitlaan custom
# Configuration file for the input service

# This section contains options which are not specific to any
# particular interface
[General]

# Set idle timeout (in minutes) before the connection will
# be disconnect (defaults to 0 for no timeout)
#IdleTimeout=30 



# This section contains options that are specific to a device
[00:1E:3D:B6:12:7E]
#
# Set a custom idle timeout (in minutes) for this device
IdleTimeout=1   



# This section is the PS3 Remote keymap.  It is loaded when bluez starts.
# Use 'uinput.h' from bluez sources or '/usr/include/linux/input.h' for
# a list of possible KEY_* values.
#
[PS3 Remote Map]
# When the 'OverlayBuiltin' option is TRUE (the default), the keymap uses
# the built-in keymap as a starting point.  When FALSE, an empty keymap is
# the starting point.
#OverlayBuiltin = TRUE
0x16 = KEY_E              # EJECT
0x64 = KEY_A              # AUDIO
0x65 = KEY_Z              # ANGLE
0x63 = KEY_T              # SUBTITLE
0x0f = KEY_DELETE         # CLEAR
0x28 = KEY_GRAVE          # TIMER
0x00 = KEY_1              # NUM-1
0x01 = KEY_2              # NUM-2
0x02 = KEY_3              # NUM-3
0x03 = KEY_4              # NUM-4
0x04 = KEY_5              # NUM-5
0x05 = KEY_6              # NUM-6
0x06 = KEY_7              # NUM-7
0x07 = KEY_8              # NUM-8
0x08 = KEY_9              # NUM-9
0x09 = KEY_0              # NUM-0
0x81 = KEY_F7             # RED
0x82 = KEY_F8             # GREEN
0x80 = KEY_F9             # BLUE
0x83 = KEY_F10            # YELLOW
0x70 = KEY_I              # DISPLAY
0x1a = KEY_S              # TOP MENU
0x40 = KEY_M              # POP UP/MENU
0x0e = KEY_ESC            # RETURN
0x5c = KEY_C              # TRIANGLE/OPTIONS
0x5d = KEY_BACKSPACE      # CIRCLE/BACK
0x5f = KEY_TAB            # SQUARE/VIEW
0x5e = KEY_SPACE          # CROSS
0x54 = KEY_UP             # UP
0x56 = KEY_DOWN           # DOWN
0x57 = KEY_LEFT           # LEFT
0x55 = KEY_RIGHT          # RIGHT
0x0b = KEY_ENTER          # ENTER
0x5a = KEY_F1             # L1
0x58 = KEY_F2             # L2
0x51 = KEY_F3             # L3
0x5b = KEY_F4             # R1
0x59 = KEY_F5             # R2
0x52 = KEY_F6             # R3
0x43 = KEY_HOMEPAGE       # PS button
0x50 = KEY_INSERT         # SELECT
0x53 = KEY_HOME           # START
0x33 = KEY_R              # SCAN BACK
0x32 = KEY_PLAY           # PLAY
0x34 = KEY_F              # SCAN FORWARD
0x30 = KEY_PAGEUP         # PREVIOUS
0x38 = KEY_STOP           # STOP
0x31 = KEY_PAGEDOWN       # NEXT
0x60 = KEY_COMMA          # SLOW/STEP BACK
0x39 = KEY_PAUSE          # PAUSE
0x61 = KEY_DOT            # SLOW/STEP FORWARD
0xff = KEY_MAX

Troubleshooting

Pairing

After pairing, running
cat /proc/bus/input/devices | grep emot
doesn't list your device, and you've got uinput loaded
lsmod | grep uinput
  • Install blueman
    sudo apt-get install blueman
  • Open System->Preferences->Bluetooth Manager.
  • If your device is listed (it should be), right click it and select Input service.
  • Go to a terminal and try pushing some buttons on the remote, it should work.

sixaxis bluetouth sur unbuntu

http://www.ps3gen.fr/tuto-utiliser-sixaxis-sous-linux-article-5442-0.html


1. Installation des outils nécessaires à la prise en charge du sixaxis en tant que joystick 

Tapez : 

 sudo apt-get install joystick jscalibrator 
Si vous n'avez pas de périphérique bluetooth (clé ou périphérique intégré), aller directement au 5ème point. 

2. Installation du bluetooth et d'un utilitaire bluetooth 

L'utilitaire va nous servir à observer les communications entre le sixaxis et l'ordinateur. Pour l'installer, tapez : 

sudo apt-get install bluetooth bluez-hcidump bluez-gnome bluez-utils 


Lorsque le programme vous demande si vous souhaiter continuer, répondez oui. 

3. Compilation du programme sixpair.c 

Ce programme va faire communiquer le sixaxis avec votre périphérique bluetooth (clé ou bluetooth intégré). Pour installer les fichiers dont le programme sixpair a besoin : 

sudo apt-get install libusb-0.1-4 libusb-dev 


Connectez le sixaxis à votre ordinateur avec un câble usb et tapez : 

dmesg 


et voici ce qu'il devrait y avoir dans la fenêtre du terminal : 

[ 1353.124000] input: Sony PLAYSTATION(R)3 Controller as /class/input/input7 
[ 1353.140000] input: USB HID v1.11 Joystick [Sony PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-1 


Téléchargez sixpair.c : 

 wget http://www.pabr.org/sixlinux/sixpair.c 

et tapez : 

 gcc -o sixpair sixpair.c -L/usr/lib -lusb 

Pour vérifier que sixpair.c a bien été compilé, faites : 

ls -l 


vous devriez voir : 

-rwxr-xr-x 1 ubuntu ubuntu    10419 2007-10-18 sixpair 


Maintenant, on va lancer sixpair : 

sudo ./sixpair  


Vous devriez voir apparaître quelque chose comme : 
 Current Bluetooth master: 00:00:00:00:00:02 
Setting master bd_addr to 00:1b:63:4f:6a:be


Déconnectez le câble usb.


4. Reconnaissance bluetooth 

Maintenant, on a besoin d'arrêter le service bluetooth pour le lancer à la main afin d'observer ce qui se passe : 

sudo /etc/init.d/bluetooth stop 

puis : 

sudo hidd --server --nocheck -n 

Notez que le –nocheck est seulement nécessaire à la première connexion. Si jamais vous avez l’erreur suivante: 

Can’t listen on HID control channel: Address already in use 

retapez la commande : 

sudo /etc/init.d/bluetooth stop 

Et si vous avez encore l’erreur, tapez : 

sudo killall hcid 

S'il n'y a pas eu d'erreur, vous devriez voir que le démon est bien lancé : 

hidd[6079]: Bluetooth HID daemon 

Dans un autre terminal, tapez : 

sudo hcidump -t -V -x 

pour observer les communications entre le sixaxis et votre ordinateur. 

Appuyez sur le bouton PS du sixaxis. Voici ce qui devrait apparaître dans le 1er terminal : 

hidd[6037]: New HID device 00:19:XX:XX:XX:XX (Sony Computer Entertainment Wireless Controller) 

et dans le 2ème : 

HCI sniffer - Bluetooth packet analyzer ver 1.39 
device: hci0 snap_len: 1028 filter: 0xffffffff 
2007-10-29 09:58:51.522109 > ACL data: handle 1 flags 0×02 dlen 17 
L2CAP(d): cid 0×0041 len 13 [psm 0] 
A1 01 00 00 00 00 00 84 88 73 7F 00 00 
2007-10-29 09:58:51.534117 > ACL data: handle 1 flags 0×02 dlen 17 
L2CAP(d): cid 0×0041 len 13 [psm 0] 
A1 01 00 00 00 00 00 84 88 73 7F 00 00 
2007-10-29 09:58:51.545124 > ACL data: handle 1 flags 0×02 dlen 17 
L2CAP(d): cid 0×0041 len 13 [psm 0] 
A1 01 00 00 00 00 00 84 88 73 7F 00 00 
... 

Si vous appuyez sur les différents boutons du sixaxis, vous verrez les valeurs affichées changer. 

Faites un CTRL-C dans les deux fenêtres terminal. Il faut maintenant redémarrer le service bluetooth : 

sudo /etc/init.d/bluetooth start 
Si l'icône :
n'apparaît pas dans votre tableau de bord (barre contenant les menus Applications, Système et l'heure), ajoutez-la en faisant un clic droit sur le tableau de bord, cliquez sur "Ajouter au tableau de bord...", puis cliquez sur le bouton "Lanceur d'applications". "Dépliez" le menu Préférences en cliquant sur le triangle, puis sélectionner Préférences Bluetooth. 



Normalement, vous devriez avoir cette fenêtre qui apparaît lorsque le bluetooth est activé et que vous avez appuyé sur le bouton PS : 


Cliquez dessus et vous aurez la fenêtre suivante : 

Cochez la case "Always grant access" ou "toujours autoriser", selon la langue de votre OS, puis validez en cliquant sur Yes. Vous devez avoir la fenêtre suivante si vous faites un clic droit puis préférences sur l'icône bluetooth et sélectionnez input : 



5. Tests en tant que joystick et calibration 

Testez la reconnaissance du sixaxis en tant que joystick : 

jstest /dev/input/js0 

Si vous voyez quelque chose comme : 

Driver version is 2.1.0. 
Joystick (Sony Computer Entertainment Wireless Controller) has 28 axes (X, Y, Z, Rz, (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null), (null)) 
and 19 buttons (Trigger, ThumbBtn, ThumbBtn2, TopBtn, TopBtn2, PinkieBtn, BaseBtn, BaseBtn2, BaseBtn3, BaseBtn4, BaseBtn5, BaseBtn6, BtnDead, BtnA, BtnB, BtnC, BtnX, BtnY, BtnZ). 
Testing ... (interrupt to exit) 
Axes:  0:     0  1:     0  2:     0  3:     0  4:     0  5:     0  6:     0  7:     0  8:     0  9:     0 10:     0 11:     0 12:     0 13:     0 14:     0 15:     0 16:     0 17:     0 18:     0 19:     0 20:     0 21:     0 22:     0 23:     0 24:     0 25:     0 26:     0 27:     0 Buttons:  0:off  1:off  2:off  3:off  4:off  5:off  6:off  7:off 

C’est bon. Vous pouvez passer à la calibration : 

sudo jscalibrator


Après avoir cliqué sur le bouton Calibrate, appuyez sur le bouton PS du sixaxis pour qu'il soit bien détecté, puis procédez à la calibration. 


6. Reconnaissance du sixaxis par la PS3