[Bluez-devel] Sony PS3 sixaxis & bluez

Frédéric Blain
2007-11-24T00:37:08Z

[-- Attachment #1: Type: text/plain, Size: 4815 bytes --]

Hello,

With the current bluez-utils version (3.22 or CVS), the PS3 bluetooth
controller (Sixaxis) is
not recognized. As a workaround, you need to use the former HID daemon
(hidd), rename
the file /var/lib/bluetooth/xx:xx:xx:xx:xx:xx/hidd to
/var/lib/bluetooth/xx:xx:xx:xx:xx:xx/input
and restart bluez with bluetoothd-service-input. It will now recognize
the controller.

I'm writting to this list to get some help to better understand the new
process used by
bluetoothd-service-input to recognize and accept devices. I've read the
code and the
documentation but I still need some information.

Could someone explains me what should be the process to establish a HID
connection
from a remote device to the host using bluetoothd-service-input ? What
are the
interactions between hcid and bluetoothd-service-input ? Do you have a
doc / diagram
explaining this ?

I think bluetoothd-service-input should listen signals from
/org/bluez/hci0 and create a
device structure when a RemoteDeviceConnected signal is intercepted,
but it doesn't
seem to work like this.

In bluetoothd-service-input, in which step of this process should the
create_device()
function be called ? I've noticed interrupt_connect_cb() &
control_connect_cb() but
I can't figure out when they will be called.

Please be indulgent, this is my first bluetooth & bluez experience ;)

Below you can find a complete description of the problem and my
investigations.

==== Problem Description ====

The sixaxis is not recognized by bluetoothd-service-input.
According hcidump, a connection is made from the device (sixaxis)
to the host controler but when trying to contact HDI on control
channel (PSM 17), bluetoothd-service-input generate an error:
"HIDP: Control: Virtual cable unplug".

As a consequence, the device try few more times to establish the
connection and then give up. Sixaxis is never recognized and
created on the host.

==== Investigations ====

Attaching GDB to the running hcid and bluetoothd-service-input
processes, I've isolated the following behavior :

**** bluetoothd-service-input side ****
At startup, it setup the callback mechanism from l2cap control
(psm 17) & interrupt (psm 19) sockets to the function
connect_event(). Later, when the device ask to open the psm 17 on
l2cap, connect_event() is called. Then :

connect_event() ==call=> input_device_set_channel() ==call==>
find_device() ==use==> GSList *devices;

In my case, GSList *devices is NULL, so connect_event() do a /* Send
unplug virtual cable to unknown devices */.

This point out that:
1- The device structure for the sixaxis has not yet been created while
opening the connection on psm 17 .
2- Having a device structure is a requirement to open & use a l2cap
channel.

**** hcid side ****
Everything looks good here.
Once the device has completed the connection with hcid, the function
conn_complete() is called.

This one will :
+ Send a dbus system signal via hcid_dbus_conn_complete() :
signal sender=:1.3 -> dest=(null destination) path=/org/bluez/hci0;
interface=org.bluez.Adapter; member=RemoteDeviceConnected
+ Read the remote name of the device

**** dbus side ****
Everytime the sixaxis tries to establish a connection with the host, the
following messages appear :

signal sender=:1.3 -> dest=(null destination) path=/org/bluez/hci0;
interface=org.bluez.Adapter; member=RemoteDeviceConnected
string "00:19:C1:ED:21:31"
signal sender=:1.3 -> dest=(null destination) path=/org/bluez/hci0;
interface=org.bluez.Adapter; member=RemoteNameUpdated
string "00:19:C1:ED:21:31"
string "PLAYSTATION(R)3 Controller"
signal sender=:1.3 -> dest=(null destination) path=/org/bluez/hci0;
interface=org.bluez.Adapter; member=RemoteDeviceDisconnected
string "00:19:C1:ED:21:31"

==== Other ====

Just to be sure, the pairing has been done using sixpair.c => same issue

# dbus-daemon --version
D-Bus Message Bus Daemon 1.0.2

# uname -a
Linux localhost 2.6.23 #3 SMP Tue Nov 13 23:08:08 CET 2007 ppc64 Cell
Broadband Engine, altivec supported GNU/Linux

Please find in attachment :
+ Output of "hcidump -w" while trying to establish a connection
+ Output of "dbus-monitor --system --monitor" while trying to establish
a connection
+ Output of syslog while trying to establish a connection

==== Workaround ====

Basically, using the file /var/lib/bluetooth/xx:xx:xx:xx:xx:xx/hidd
renamed as input will help since at startup,
bluetoothd-service-input will scan this file and fill 'GSList *devices'
accordingly.
Also, the file /var/lib/bluetooth/xx:xx:xx:xx:xx:xx/trusts has to be
updated .

For those interested, a step by step description can be found here :
http://creber.free.fr/frederic-blain/index.php?n=Main.GentooOnPS3SixaxisBluetooth#Workaround.

Thanks in advance for your help,

--
creber

[-- Attachment #2: sixaxis-logs.tbz2 --]
[-- Type: application/octet-stream, Size: 7809 bytes --]

[-- Attachment #3: Type: text/plain, Size: 228 bytes --]

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

[-- Attachment #4: Type: text/plain, Size: 164 bytes --]