2014-12-16 17:24:21

by Veseli Veseljko

[permalink] [raw]
Subject: ShanWan Sixaxis PS3 controller

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


2014-12-19 11:53:38

by Veseli Veseljko

[permalink] [raw]
Subject: Re: ShanWan Sixaxis PS3 controller

On Thursday, 2014-12-18, at 12:24:59 +0100, Szymon Janc wrote:
> 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.

> 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/".

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

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

> 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


Attachments:
(No filename) (1.68 kB)
syslog.txt (4.57 kB)
hcidump.txt (4.87 kB)
Download all attachments

2014-12-18 11:24:59

by Szymon Janc

[permalink] [raw]
Subject: Re: ShanWan Sixaxis PS3 controller

Hi Veseli,

On Wednesday 17 of December 2014 14:36:13 Veseli Veseljko wrote:
> On Tuesday, 2014-12-16, at 18:24:21 +0100, Veseli Veseljko wrote:
> > 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.


--
Best regards,
Szymon Janc

2014-12-17 13:36:13

by Veseli Veseljko

[permalink] [raw]
Subject: Re: ShanWan Sixaxis PS3 controller

On Tuesday, 2014-12-16, at 18:24:21 +0100, Veseli Veseljko wrote:
> 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

2015-01-02 14:12:03

by Szymon Janc

[permalink] [raw]
Subject: Re: ShanWan Sixaxis PS3 controller

Hi Veseli,

On Fri, Dec 19, 2014 at 12:53 PM, Veseli Veseljko <[email protected]> wrote:
> On Thursday, 2014-12-18, at 12:24:59 +0100, Szymon Janc wrote:
>> 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.
>
>> 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/".
>
>> 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----
>
>> 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.

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

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

--
pozdrawiam
Szymon K. Janc
[email protected]