Skip to contentSkip to conversation

ShanWan Sixaxis PS3 controller

DISCUSSION Veseli Veseljko 3 participants 5 messages Dec 16, 2014 – Jan 2, 2015 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

Dear bluez developers,

I have a Sony PS3 Sixaxis compatible controller made by ShanWan. Is it possible to make it work with bluez sixaxis plugin? I tried it on Ubuntu 14.10 running Linux kernel 3.16 and bluez 5.20, compiled with sixaxis option.

I've paired this sixaxis controller with sixpair tool. I've run 'bluetoothctl' and issued commands 'agent on', 'default-agent', 'pairable on', 'power on' and pressed 'PS' button on controller, but didn't get sixaxis controller to pair:

----bluetoothctl--begin----
[NEW] Controller 00:20:E0:xx:xx:xx desktop [default] [bluetooth]# agent on
Agent registered
[bluetooth]# default-agent
Default agent request successful [bluetooth]# pairable on
Changing pairable on succeeded
[bluetooth]# power on
[CHG] Controller 00:20:E0:xx:xx:xx Class: 0x00010c Changing power on succeeded
[CHG] Controller 00:20:E0:xx:xx:xx Powered: yes [NEW] Device 00:16:FE:xx:xx:xx 00-16-FE-xx-xx-xx [bluetooth]# trust 00:16:FE:xx:xx:xx
[CHG] Device 00:16:FE:xx:xx:xx Trusted: yes Changing 00:16:FE:xx:xx:xx trust succeeded [CHG] Device 00:16:FE:xx:xx:xx Connected: no [DEL] Device 00:16:FE:xx:xx:xx 00-16-FE-xx-xx-xx ----bluetoothctl------

In syslog I got following messages:

----/var/log/syslog--part1--begin----
bluetoothd[648]: Refusing input device connect: No such file or directory (2) bluetoothd[648]: Refusing connection from 00:16:FE:xx:xx:xx: unknown device ----/var/log/syslog--part1--end----

I'v run 'hcidump -x' and two parts of the dump caught my attention.

Misspelled controller name 'PLAYSTATION(R)3Conteroller-VINS':

----hcidump--part1--begin----

Quoted 1 line

HCI Event: Remote Name Req Complete (0x07) plen 255

    status 0x00 bdaddr 00:16:FE:xx:xx:xx name 'PLAYSTATION(R)3Conteroller-VINS'

----hcidump--part1--end----

Bluez disconnected sixaxis controller, and then controller was refused to connect:

----hcidump--part2--begin----
< ACL data: handle 41 flags 0x02 dlen 5
L2CAP(d): cid 0x20ee len 1 [psm 17]
HIDP: Control: Virtual cable unplug
< ACL data: handle 41 flags 0x02 dlen 12

    L2CAP(s): Disconn req: dcid 0x20ee scid 0x0040
Quoted 1 line

ACL data: handle 41 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 19 scid 0x20ef

< ACL data: handle 41 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0041 scid 0x20ef result 1 status 2
Connection pending - Authorization pending
< ACL data: handle 41 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0041 scid 0x20ef result 3 status 0
Connection refused - security block
----hcidump--part2--end----

It looks like 'trust 00:16:FE:xx:xx:xx' in bluetoothctl has no effect.

When I connect this sixaxis controller to USB, I got following lines in syslog:

----/var/log/syslog--part2--begin----
usb 2-2: new full-speed USB device number 2 using uhci_hcd usb 2-2: New USB device found, idVendor=054c, idProduct=0268 usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0 usb 2-2: Product: PLAYSTATION(R)3 Controller
usb 2-2: Manufacturer: ShanWan
hidraw: raw HID events driver (C) Jiri Kosina
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
sony 0003:054C:0268.0001: Fixing up Sony Sixaxis report descriptor sony 0003:054C:0268.0001: usb_submit_urb(ctrl) failed: -1 sony 0003:054C:0268.0001: timeout initializing reports
input: ShanWan PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/0003:054C:0268.0001/input/input13
sony 0003:054C:0268.0001: input,hiddev0,hidraw0: USB HID v1.10 Joystick [ShanWan PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-2/input0
----/var/log/syslog--part2--end----

This sixaxis controller works as joystick input device when it is connected to USB. It also works ower bluetooth with SHANWAN_FAKE_DS3 branch of sixad from:

https://github.com/yarick123/qtsixa/tree/feature/SHANWAN_FAKE_DS3

The problem with sixad is that it takes over bluetooth service and other bluetooth devices can't connect when sixad is active and that is the reason why I would like to ge it work with bluez.

Please tell me if you need any more information.

Best regards,

Veseljko

#1 lore raw
Quoted 4 lines · Veseli Veseljko

I have a Sony PS3 Sixaxis compatible controller made by ShanWan. Is it possible to make it work with bluez sixaxis plugin? I tried it on Ubuntu 14.10 running Linux kernel 3.16 and bluez 5.20, compiled with sixaxis option.

I added some DBGs into "/profiles/input/server.c" code and I found out that when dev_is_sixaxis is run, both vendor ID and product ID for this controller are 0x0000.

Any ideas?

Best regards,

Veseljko

#2 lore raw

Hi Veseli,

Quoted 11 lines · On Wednesday 17 of December 2014 14:36:13 Veseli Veseljko wrote:
Quoted 4 lines · Veseli Veseljko

I have a Sony PS3 Sixaxis compatible controller made by ShanWan. Is it possible to make it work with bluez sixaxis plugin? I tried it on Ubuntu 14.10 running Linux kernel 3.16 and bluez 5.20, compiled with sixaxis option.

I added some DBGs into "/profiles/input/server.c" code and I found out that when dev_is_sixaxis is run, both vendor ID and product ID for this controller are 0x0000.

Any ideas?

Typically DS3 should be handled like this:

1. make sure you don't have sixad/qtsixa installed as it was reported that it conflicted with sixpair plugin (udev rules)
2. make sure you have sixaxis plugin installed - this plugin depends on udev so it is not builin into bluetoothd but loaded on start from /usr/lib/bluetooth/plugins
3. plug it into USB (don't press PS button yet)
you should see something like "sixaxis: compatible device connected: ...." in bluetoothd logs
4. unplug it
5. press PS button

Device should now connect and you should be asked (in bluetoothctl or UI) to authorize connection. After that you should be able to reconnect without need of pluging it with USB first.

This was mostly tested with genuine controllers. There were reports that some of clone devices doesn't behave exactly the same ie. use different pid/vid or don't report correct BT address over USB. Making them work would probably require some extra work, but I don't have any of those clone devices.

Signature · 2 lines
Best regards, 
Szymon Janc
#3 lore raw
Quoted 4 lines · Szymon Janc

Typically DS3 should be handled like this:

1. make sure you don't have sixad/qtsixa installed as it was reported that it conflicted with sixpair plugin (udev rules)

I've uninstalled sixad and qtsixa.

Quoted 3 lines

2. make sure you have sixaxis plugin installed - this plugin depends on udev so it is not builin into bluetoothd but loaded on start from /usr/lib/bluetooth/plugins

Yes, plugin "sixaxis.so" is installed in
"/usr/lib/i386-linux-gnu/bluetooth/plugins/".

Quoted 3 lines

3. plug it into USB (don't press PS button yet) you should see something like "sixaxis: compatible device connected: ...." in bluetoothd logs

Yes, I got it in the logs:

---begin---
bluetoothd[24934]: sixaxis: compatible device connected: PLAYSTATION(R)3
Controller (054C:0268)
bluetoothd[24934]: sixaxis: setting up new device ----end----

Quoted 6 lines

4. unplug it
5. press PS button

Device should now connect and you should be asked (in bluetoothctl or UI) to authorize connection. After that you should be able to reconnect without need of pluging it with USB first.

I did as you said, but I haven't been asked to authorize connection.

I attached logs from bluetoothd run with "-d" and hcidump of what has happened when I pressed PS button.

Quoted 5 lines

This was mostly tested with genuine controllers. There were reports that some of clone devices doesn't behave exactly the same ie. use different pid/vid or don't report correct BT address over USB. Making them work would probably require some extra work, but I don't have any of those clone devices.

I could order one of those clone controllers for you if you provide me your delivery address.

Best regards,

Veseljko

kernel: [89396.404095] usb 2-2: new full-speed USB device number 6 using uhci_hcd
kernel: [89396.589056] usb 2-2: New USB device found, idVendor=054c, idProduct=0268
kernel: [89396.589065] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
kernel: [89396.589069] usb 2-2: Product: PLAYSTATION(R)3 Controller
kernel: [89396.589073] usb 2-2: Manufacturer: ShanWan
kernel: [89396.629190] sony 0003:054C:0268.0005: Fixing up Sony Sixaxis report descriptor
kernel: [89396.669211] input: ShanWan PLAYSTATION(R)3 Controller as /devices/pci0000:00/0000:00:1d.0/usb2/2-2/2-2:1.0/0003:054C:0268.0005/input/input19
kernel: [89396.675612] sony 0003:054C:0268.0005: input,hiddev0,hidraw0: USB HID v1.10 Joystick [ShanWan PLAYSTATION(R)3 Controller] on usb-0000:00:1d.0-2/input0
bluetoothd[24934]: sixaxis: compatible device connected: PLAYSTATION(R)3 Controller (054C:0268) bluetoothd[24934]: plugins/sixaxis.c:setup_device() remote 00:16:FE:xx:xx:xx old_master 00:20:E0:xx:xx:xx new_master 00:20:E0:xx:xx:xx bluetoothd[24934]: src/device.c:device_create() dst 00:16:FE:xx:xx:xx
bluetoothd[24934]: src/device.c:device_new() address 00:16:FE:xx:xx:xx
bluetoothd[24934]: src/device.c:device_new() Creating device /org/bluez/hci0/dev_00_16_FE_xx_xx_xx bluetoothd[24934]: sixaxis: setting up new device
bluetoothd[24934]: src/device.c:btd_device_device_set_name() /org/bluez/hci0/dev_00_16_FE_xx_xx_xx PLAYSTATION(R)3 Controller bluetoothd[24934]: src/device.c:btd_device_set_temporary() temporary 0
bluetoothd[24934]: plugins/sixaxis.c:get_leds_data() number 1
bluetoothd[24934]: src/device.c:btd_device_set_trusted() trusted 1
kernel: [89456.744176] usb 2-2: USB disconnect, device number 6
bluetoothd[24934]: src/adapter.c:connected_callback() hci0 device 00:16:FE:xx:xx:xx connected eir_len 5 bluetoothd[24934]: src/device.c:device_set_class() /org/bluez/hci0/dev_00_16_FE_xx_xx_xx 0x001F00 bluetoothd[24934]: profiles/input/server.c:connect_event_cb() Incoming connection from 00:16:FE:xx:xx:xx on PSM 17 bluetoothd[24934]: profiles/input/device.c:input_device_set_channel() idev (nil) psm 17
bluetoothd[24934]: profiles/input/server.c:confirm_event_cb()
bluetoothd[24934]: 00:16:FE:xx:xx:xx: error updating services: Connection timed out (110)
bluetoothd[24934]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_00_16_FE_xx_xx_xx err -110 bluetoothd[24934]: profiles/input/server.c:sixaxis_sdp_cb() err -110 (Connection timed out)
bluetoothd[24934]: HUP or ERR on socket: Connection timed out (110)
bluetoothd[24934]: src/adapter.c:dev_disconnected() Device 00:16:FE:xx:xx:xx disconnected, reason 2 bluetoothd[24934]: src/adapter.c:adapter_remove_connection()
bluetoothd[24934]: plugins/policy.c:disconnect_cb() reason 2
bluetoothd[24934]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 00:16:FE:xx:xx:xx type 0 status 0xe bluetoothd[24934]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[24934]: src/device.c:device_bonding_failed() status 14
bluetoothd[24934]: src/adapter.c:resume_discovery()
bluetoothd[24934]: src/adapter.c:connected_callback() hci0 device 00:16:FE:xx:xx:xx connected eir_len 5 bluetoothd[24934]: profiles/input/server.c:connect_event_cb() Incoming connection from 00:16:FE:xx:xx:xx on PSM 17 bluetoothd[24934]: profiles/input/device.c:input_device_set_channel() idev (nil) psm 17
bluetoothd[24934]: profiles/input/server.c:sixaxis_sdp_cb() err 0 (Success)
bluetoothd[24934]: profiles/input/device.c:input_device_set_channel() idev (nil) psm 17
bluetoothd[24934]: profiles/input/server.c:confirm_event_cb()
bluetoothd[24934]: profiles/input/server.c:connect_event_cb() Incoming connection from 00:16:FE:xx:xx:xx on PSM 19 bluetoothd[24934]: profiles/input/device.c:input_device_set_channel() idev (nil) psm 19
bluetoothd[24934]: profiles/input/server.c:sixaxis_sdp_cb() err 0 (Success)
bluetoothd[24934]: profiles/input/device.c:input_device_set_channel() idev (nil) psm 19
bluetoothd[24934]: 00:16:FE:xx:xx:xx: error updating services: Connection timed out (110)
bluetoothd[24934]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_00_16_FE_xx_xx_xx err -110 bluetoothd[24934]: src/adapter.c:dev_disconnected() Device 00:16:FE:xx:xx:xx disconnected, reason 2 bluetoothd[24934]: src/adapter.c:adapter_remove_connection()
bluetoothd[24934]: plugins/policy.c:disconnect_cb() reason 2
bluetoothd[24934]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 00:16:FE:xx:xx:xx type 0 status 0xe bluetoothd[24934]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e
bluetoothd[24934]: src/device.c:device_bonding_failed() status 14
bluetoothd[24934]: src/adapter.c:resume_discovery()

Quoted 1 line

HCI Event: Connect Request (0x04) plen 10

    bdaddr 00:16:FE:xx:xx:xx class 0x001f00 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
    bdaddr 00:16:FE:xx:xx:xx role 0x00
    Role: Master
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Role Change (0x12) plen 8

    status 0x00 bdaddr 00:16:FE:xx:xx:xx role 0x00
    Role: Master
Quoted 1 line

HCI Event: Connect Complete (0x03) plen 11

    status 0x00 handle 41 bdaddr 00:16:FE:xx:xx:xx type ACL encrypt 0x00

< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
handle 41

Quoted 1 line

HCI Event: Page Scan Repetition Mode Change (0x20) plen 7

    bdaddr 00:16:FE:xx:xx:xx mode 1
Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1

< HCI Command: Change Connection Packet Type (0x01|0x000f) plen 4
handle 41 ptype 0xcc18
Packet type: DM1 DM3 DM5 DH1 DH3 DH5

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Change Connection Packet Type (0x01|0x000f) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Connection Packet Type Changed (0x1d) plen 5

status 0x00 handle 41 ptype 0x0018
Packet type: DM1 DH1

Quoted 1 line

ACL data: handle 41 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 17 scid 0x20ee
Quoted 1 line

HCI Event: Read Remote Supported Features (0x0b) plen 11

    status 0x00 handle 41
    Features: 0xfc 0x07 0x82 0x7a 0x08 0x18 0x00 0x80
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
    bdaddr 00:16:FE:xx:xx:xx mode 2 clkoffset 0x0000

< ACL data: handle 41 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x20ee result 1 status 0
Connection pending - No futher information available
< ACL data: handle 41 flags 0x02 dlen 10
L2CAP(s): Info req: type 2

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 2

Quoted 1 line

HCI Event: Remote Name Req Complete (0x07) plen 255

    status 0x00 bdaddr 00:16:FE:xx:xx:xx name 'PLAYSTATION(R)3Conteroller-VINS'
< ACL data: handle 41 flags 0x02 dlen 16
    L2CAP(s): Connect rsp: dcid 0x0040 scid 0x20ee result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x20ee flags 0x00 clen 0
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

ACL data: handle 41 flags 0x02 dlen 12

    L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 0
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x20ee flags 0x00 result 0 clen 4
      MTU 672 
Quoted 1 line

ACL data: handle 41 flags 0x02 dlen 14

    L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Connect req: psm 1 scid 0x0041
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x20ee scid 0x0040
Quoted 1 line

ACL data: handle 41 flags 0x02 dlen 12

    L2CAP(s): Connect req: psm 19 scid 0x20ef

< ACL data: handle 41 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0042 scid 0x20ef result 1 status 2
Connection pending - Authorization pending
< ACL data: handle 41 flags 0x02 dlen 16

    L2CAP(s): Connect rsp: dcid 0x0042 scid 0x20ef result 0 status 0
      Connection successful
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Config req: dcid 0x20ef flags 0x00 clen 0
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 3 lines

ACL data: handle 41 flags 0x02 dlen 16
ACL data: handle 41 flags 0x01 dlen 16
ACL data: handle 41 flags 0x01 dlen 4

    L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 24
      QoS 0x02 (Guaranteed) 
< ACL data: handle 41 flags 0x02 dlen 18
    L2CAP(s): Config rsp: scid 0x20ef flags 0x00 result 0 clen 4
      MTU 672 
Quoted 1 line

ACL data: handle 41 flags 0x02 dlen 14

    L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 0
      Success
< ACL data: handle 41 flags 0x02 dlen 12
    L2CAP(s): Disconn req: dcid 0x20ef scid 0x0042
Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1

Quoted 1 line

HCI Event: Number of Completed Packets (0x13) plen 5

handle 41 packets 1
< HCI Command: Disconnect (0x01|0x0006) plen 3
handle 41 reason 0x13
Reason: Remote User Terminated Connection

Quoted 1 line

HCI Event: Command Status (0x0f) plen 4

    Disconnect (0x01|0x0006) status 0x00 ncmd 1
Quoted 1 line

HCI Event: Disconn Complete (0x05) plen 4

status 0x00 handle 41 reason 0x16
Reason: Connection Terminated by Local Host

#4 lore raw

Hi Veseli,

Quoted 30 lines · Veseli Veseljko
Quoted 4 lines · Szymon Janc

Typically DS3 should be handled like this:

1. make sure you don't have sixad/qtsixa installed as it was reported that it conflicted with sixpair plugin (udev rules)

I've uninstalled sixad and qtsixa.

Quoted 3 lines

2. make sure you have sixaxis plugin installed - this plugin depends on udev so it is not builin into bluetoothd but loaded on start from /usr/lib/bluetooth/plugins

Yes, plugin "sixaxis.so" is installed in
"/usr/lib/i386-linux-gnu/bluetooth/plugins/".

Quoted 3 lines

3. plug it into USB (don't press PS button yet) you should see something like "sixaxis: compatible device connected: ...." in bluetoothd logs

Yes, I got it in the logs:

---begin---
bluetoothd[24934]: sixaxis: compatible device connected: PLAYSTATION(R)3
Controller (054C:0268)
bluetoothd[24934]: sixaxis: setting up new device ----end----

Quoted 3 lines

4. unplug it
5. press PS button

Quoted 8 lines
Quoted 3 lines

Device should now connect and you should be asked (in bluetoothctl or UI) to authorize connection. After that you should be able to reconnect without need of pluging it with USB first.

I did as you said, but I haven't been asked to authorize connection.

I attached logs from bluetoothd run with "-d" and hcidump of what has happened when I pressed PS button.

It looks like this clone controller is rejecting SDP connection and as result no input device is created.

I have to think a bit on how we could provide this info out-of-band in clean way that is feasible for upstream inclusion...

Quoted 9 lines
Quoted 6 lines

This was mostly tested with genuine controllers. There were reports that some of clone devices doesn't behave exactly the same ie. use different pid/vid or don't report correct BT address over USB. Making them work would probably require some extra work, but I don't have any of those clone devices.

I could order one of those clone controllers for you if you provide me your delivery address.

I'm a bit reluctant to this since I don't want to make any promises about adding support for this device.

Signature · 3 lines
pozdrawiam
Szymon K. Janc
[email protected]