# Re: \[PATCH v2 0/3\] Another try for the Sixaxis plugin

- List: linux-input
- 4 messages, 3 authors
- Page: https://ratatoskr.run/linux-input/2011/02/8916236/t

## Re: \[PATCH v2 0/3\] Another try for the Sixaxis plugin

- From: Bastien Nocera \<hidden\>
- Date: 2011-02-25 12:34:02 
- Message: https://ratatoskr.run/linux-input/2011/02/8916236.md

```text
On Fri, 2011-02-25 at 11:04 +0100, Antonio Ospite wrote:
> Hi,
> 
> this is another attempt to get the sixaxis plugin merged upstream in
> bluez, now cable pairing is done without libusb, which is good because
> the hid driver does not need to be detached anymore.

Good stuff.

> The work is based on patches by Bastian Nocera, so its SOB line comes
> first on the third patch, even though many parts have been totally
> reimplemented.  More comments on the patch itself.
> 
> Bastien, I took the liberty to impersonate you in the second patch about
> re-adding manager_get_default_adapter(), because the change was taken
> out from your bluez rpm package. I hope this is OK.

Both fine by me.

> I was wondering if it was possible to have the equivalent of this plugin
> as a separate daemon doing the association part with bluez over dbus,
> instead of having it builtin (I do not know the bluez dbus interface at
> all), and if there were any major drawbacks with that compared to the
> builtin plugin. What are your opinions on that?

This was already discussed, and I even created a patch to allow outside
pairing. I don't think there's much of a point doing this outside of
bluetoothd though, and Marcel preferred the pairing to be done within
bluetoothd.

> Anyhow,
> 
> HOWTO test it:
>   - Get a kernel supporting HIDIOCSFEATURE and HIDIOCGFEATURE: linux-next
>     should have that, or Jiki Kosina's hidraw-feature branch:
>     http://git.kernel.org/?p=linux/kernel/git/jikos/hid.git;a=shortlog;h=refs/heads/hidraw-feature
>   - Build it and install it with its linux-libc-dev package ("make
>     deb-pkg" on recent kernels builds that already).
>   - Apply the patches in this series and configure bluez, the ioctl
>     above should be detected automatically and the plugin enabled.
>   - If there is any problem, try backing up and cleaning up
>     /var/lib/bluetooth/
> 
> TODO before merging:
>   - Check the routine about bluetooth association. Also, is it strictly
>     necessary to grant manually the first connection?

The line setting the device trust should be enough to not have to
manually grant the first connection. You might want to double-check what
changes between the state of /var/lib/bluetooth after cable pairing and
before connecting for the first time.

>   - Add the actual official version of linux-libc-dev in which the
>     hidraw ioctl will be merged (now it is just 2.6.3x as a
>     placeholder).
>   - Check the last comment from Marcel about the timeout in
>     http://marc.info/?l=linux-bluetooth&m=125525415718147&w=2 Could you
>     comment on the third patch about that, please?

The timeout was to avoid reading data while udev was probing the device.
This might not be necessary anymore.

>   - When the controller is connected via USB after it is working over BT
>     it is seen as a second controller and the second LED is turned on,
>     should we force BT disconnection on USB connection?

If we can assert that the device is the same one, yes, I think we
should.

>   - Test with multiple controllers, and/or multiple BT adapters, which I
>     can't do right now.
>   - Remove the XXX comment about the lowercase hex bdaddr format.
> 
> 
> FUTURE plans:
>  - Add support for battery status report

Where is the battery level exported currently?

>  - Add support for Playstation Move (I don't have the hardware, tho),
>    Pascal?

The PS3 add-on keyboard, and the PS3 headset both use cable pairing. I
have them around, but was unable to get them to pair.

Cheers
```

## Re: \[PATCH v2 0/3\] Another try for the Sixaxis plugin

- From: Antonio Ospite \<hidden\>
- Date: 2011-03-24 17:33:24 
- Message: https://ratatoskr.run/linux-input/2011/03/8916445.md

```text
On Fri, 25 Feb 2011 12:34:02 +0000
Bastien Nocera [ref] wrote:

> On Fri, 2011-02-25 at 11:04 +0100, Antonio Ospite wrote:
[...]
> > 
> > TODO before merging:
> >   - Check the routine about bluetooth association. Also, is it strictly
> >     necessary to grant manually the first connection?
> 
> The line setting the device trust should be enough to not have to
> manually grant the first connection. You might want to double-check what
> changes between the state of /var/lib/bluetooth after cable pairing and
> before connecting for the first time.
>

Calling write_trust() before adapter_get_device() fixes the prompt on
the first association, AFAICS adapter_get_device() reads the trust file.

> >   - When the controller is connected via USB after it is working over BT
> >     it is seen as a second controller and the second LED is turned on,
> >     should we force BT disconnection on USB connection?
> 
> If we can assert that the device is the same one, yes, I think we
> should.
>

With regard to that, I'd like to see some USB dumps of a Sixaxis
talking with GameOS to check if the PS3 can turn off BT on the
controller explicitly, can anyone help here? (Pascal? Do you have
access to a USB analyzer?):

The scenarios I am interested in are:
 1. Connect a non-paired Sixaxis to the PS3 via USB
 2. Connect an already paired Sixaxis to the PS3 via USB
 3. Connect a Sixaxis already associated via BT to a PS3 via USB

> >   - Test with multiple controllers, and/or multiple BT adapters, which I
> >     can't do right now.
> >   - Remove the XXX comment about the lowercase hex bdaddr format.
> >

Another TODO item: avoid setting the led before the controller sends
input events (this is the GameOS behavior as well): I am planning to add
a blocking read() in order to wait for the user to press the PS button
before setting the led, I'll emphasize that in the next review round.

> > 
> > FUTURE plans:
> >  - Add support for battery status report
> 
> Where is the battery level exported currently?
>

It is exported in the input report.

> >  - Add support for Playstation Move (I don't have the hardware, tho),
> >    Pascal?
> 
> The PS3 add-on keyboard, and the PS3 headset both use cable pairing. I
> have them around, but was unable to get them to pair.
>

I don't have the hardware so I never searched to see what the
differences with the Sixaxis are.

Regards,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
```

## Re: \[PATCH v2 0/3\] Another try for the Sixaxis plugin

- From: Jim Paris \<jim@jtan.com\>
- Date: 2011-03-25 15:37:20 
- Message: https://ratatoskr.run/linux-input/2011/03/8916448.md

```text
Antonio Ospite wrote:
> With regard to that, I'd like to see some USB dumps of a Sixaxis
> talking with GameOS to check if the PS3 can turn off BT on the
> controller explicitly, can anyone help here? (Pascal? Do you have
> access to a USB analyzer?):
> 
> The scenarios I am interested in are:
>  1. Connect a non-paired Sixaxis to the PS3 via USB
>  2. Connect an already paired Sixaxis to the PS3 via USB
>  3. Connect a Sixaxis already associated via BT to a PS3 via USB

Hi Antonio,

You asked me for this a while ago, sorry it took so long.  I ran some
tests and put the log files here:
  http://ps3.jim.sh/sixaxis/dumps/

There are comments in the file:

$ grep Comment sixaxis-pairing-tests-abbreviated.csv 
0,,2,0:03.145.728,,,,,,Comment,,"1. Controller is a DS3 model CECHZC2U, bdaddr 00:24:33:E6:2C:3C"
0,,3,0:04.893.354,,,,,,Comment,,"2. PS3-1 is on and has bdaddr 00:13:a9:74:fe:57"
0,,4,0:05.592.405,,,,,,Comment,,"3. PS3-2 is on and has bdaddr 00:23:06:52:e4:e3"
0,,5,0:05.941.930,,,,,,Comment,,"4. Controller previously paired with 00:11:22:33:44:55"
0,,6,0:06.640.981,,,,,,Comment,,"5. Controller powered off with rear button"
0,,7,0:08.738.133,,,,,,Comment,,"6. About to plug controller into PS3-1 (off, wrong pairing)"
0,,285,0:16.314.138,,,,,,Comment,,"7. About to press PS button"
0,,914,0:20.841.170,,,,,,Comment,,"8. Unplugged controller"
0,,915,0:34.123.132,,,,,,Comment,,"9. Controller is now associated with PS3-1"
0,,916,0:41.113.639,,,,,,Comment,,"10. Controller powered off with rear button"
0,,917,0:41.113.639,,,,,,Comment,,"11. About to plug controller into PS3-1 (off, correct pairing)"
0,,1193,1:01.075.280,,,,,,Comment,,"12. Unplugged controller"
0,,1194,1:11.211.515,,,,,,Comment,,"13. Pressed PS button"
0,,1195,1:27.639.205,,,,,,Comment,,"14. Controller is now associated with PS3-1"
0,,1196,1:27.639.205,,,,,,Comment,,"15. About to plug controller into PS3-1 (associated with this PS3)"
0,,2311,1:41.665.351,,,,,,Comment,,"16. Unplugged controller"
0,,2312,1:44.112.029,,,,,,Comment,,"17. Paired and associated controller with PS3-2"
0,,2313,1:57.393.991,,,,,,Comment,,"18. About to plug controller into PS3-1 (associated with different PS3)"
0,,4585,2:26.172.515,,,,,,Comment,,"19. Unplugged controller"

> > The PS3 add-on keyboard, and the PS3 headset both use cable pairing. I
> > have them around, but was unable to get them to pair.
> 
> I don't have the hardware so I never searched to see what the
> differences with the Sixaxis are.

I also did some quick captures of pairing the keypad (CECHZK1UC) and
original headset (CECHYA-0075).  They are being paired with 00:13:a9:74:fe:57.
  http://ps3.jim.sh/sixaxis/dumps/

-jim
```

## Re: \[PATCH v2 0/3\] Another try for the Sixaxis plugin

- From: Antonio Ospite \<hidden\>
- Date: 2011-03-25 16:27:32 
- Message: https://ratatoskr.run/linux-input/2011/03/8916449.md

```text
On Fri, 25 Mar 2011 11:31:05 -0400
Jim Paris [ref] wrote:

> Antonio Ospite wrote:
> > With regard to that, I'd like to see some USB dumps of a Sixaxis
> > talking with GameOS to check if the PS3 can turn off BT on the
> > controller explicitly, can anyone help here? (Pascal? Do you have
> > access to a USB analyzer?):
> > 
> > The scenarios I am interested in are:
> >  1. Connect a non-paired Sixaxis to the PS3 via USB
> >  2. Connect an already paired Sixaxis to the PS3 via USB
> >  3. Connect a Sixaxis already associated via BT to a PS3 via USB
> 
> Hi Antonio,
> 
> You asked me for this a while ago, sorry it took so long.  I ran some
> tests and put the log files here:
>   http://ps3.jim.sh/sixaxis/dumps/
>

Thanks a lot Jim, now I know what to do if I got bored this weekend.

[...]
> I also did some quick captures of pairing the keypad (CECHZK1UC) and
> original headset (CECHYA-0075).  They are being paired with 00:13:a9:74:fe:57.
>   http://ps3.jim.sh/sixaxis/dumps/
> 
> -jim
>

If I get to taking a look at those I could ask Bastien to test some
stuff too :)

Thanks,
   Antonio

-- 
Antonio Ospite
http://ao2.it

PGP public key ID: 0x4553B001

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
```
