Showing posts with label sixaxis. Show all posts
Showing posts with label sixaxis. Show all posts

Wednesday, 20 September 2017

Bluetooth on Fedora: joypads and (more) security

It's been a while since I posted about Fedora specific Bluetooth enhancements, and even longer that I posted about PlayStation controllers support.

Let's start with the nice feature.

Dual-Shock 3 and 4 support

We've had support for Dual-Shock 3 (aka Sixaxis, aka PlayStation 3 controllers) for a long while, but I've added a long-standing patchset to the Fedora packages that changes the way devices are setup.

The old way was: plug in your joypad via USB, disconnect it, and press the "P" button on the pad. At this point, and since GNOME 3.12, you would have needed the Bluetooth Settings panel opened for a question to pop up about whether the joypad can connect.

This is broken in a number of ways. If you were trying to just charge the joypad, then it would forget its original "console" and you would need to plug it in again. If you didn't have the Bluetooth panel opened when trying to use it wirelessly, then it just wouldn't have worked.

Set up is now simpler. Open the Bluetooth panel, plug in your device, and answer the question. You just want to charge it? Dismiss the query, or simply don't open the Bluetooth panel, it'll work dandily and won't overwrite the joypad's settings.


And finally, we also made sure that it works with PlayStation 4 controllers.



Note that the PlayStation 4 controller has a button combination that allows it to be visible and pairable, except that if the device trying to connect with it doesn't behave in a particular way (probably the same way the 25€ RRP USB adapter does), it just wouldn't work. And it didn't work for me on a number of different devices.

Cable pairing for the win!

And the boring stuff

Hey, do you know what happened last week? There was a security problem in a package that I glance at sideways sometimes! Yes. Again.

A good way to minimise the problems caused by problems like this one is to lock the program down. In much the same way that you'd want to restrict thumbnailers, or even end-user applications, we can forbid certain functionality from being available when launched via systemd.

We've finally done this in recent fprintd and iio-sensor-proxy upstream releases, as well as for bluez in Fedora Rawhide. If testing goes well, we will integrate this in Fedora 27.

Friday, 22 May 2009

Sixaxis support in BlueZ

Getting the Sixaxis PlayStation 3 joypad to work with Linux (in Bluetooth mode) is a bit of a pain. There were my various attempts at cleaning up the code lying around on the Internet, and hacks involving hidd.

The way to set the pad up in Bluetooth mode is fairly straight forward:
  • Open the USB device
  • Get the device's Bluetooth address through magic USB commands
  • Write your Bluetooth adapter's address in the pad (magic USB commands again), and then give the device back to the USB HID driver, so that it works as a pad through USB.
  • Set up the internals of bluetoothd so it recognises the device, and allows it to connect to your computer
  • When the device connects through Bluetooth, poke at it with magic commands again to enable its HID mode (code is already in bluetoothd's input plugin)
Yesterday I refactored my code as a bluetoothd plugin.

First up, detecting the device being plugged in. I wanted to use DeviceKit's GObject helper library, but it uses the D-Bus DeviceKit daemon which will be going away (note, this is just the DeviceKit daemon itself, not the -power, or -disks "sub"-daemons), in favour of libudev usage.

So I ported devkit-gobject to use libudev directly. Patch is currently being reviewed (it's in DavidZ's inbox), and it should show up soon in udev-extras under a different namespace.

After a bit of work, I had a bluetoothd plugin that detected PS3 pads being plugged in, and did the necessary work to make bluetoothd recognise it on plug.


Next, finishing up the libudev GObject helper library, and getting the bluetoothd plugin reviewed. And it would be nice to finally get the extra functionality merged into a hid driver in the kernel.

PS: Any info on the PS3 Headset or the keypad?