Friday, 15 December 2017

More Bluetooth (and gaming) features

In the midst of post-release bug fixing, we've also added a fair number of new features to our stack. As usual, new features span a number of different components, so integrators will have to be careful picking up all the components when, well, integrating.

PS3 clones joypads support

Do you have a PlayStation 3 joypad that feels just a little bit "off"? You can't find the Sony logo anywhere on it? The figures on the face buttons look like barbed wire? And if it were a YouTube video, it would say "No copyright intended"?


Bingo. When plugged in via USB, those devices advertise themselves as SHANWAN or Gasia, and implement the bare minimum to work when plugged into a PlayStation 3 console. But as a Linux computer would behave slightly differently, we need to fix a couple of things.

The first fix was simple, but necessary to be able to do any work: disable the rumble motor that starts as soon as you plug the pad through USB.

Once that's done, we could work around the fact that the device isn't Bluetooth compliant, and hard-code the HID service it's supposed to offer.

Bluetooth LE Battery reporting

Bluetooth Low Energy is the new-fangled (7-year old) protocol for low throughput devices, from a single coin-cell powered sensor, to input devices. What's great is that there's finally a standardised way for devices to export their battery statuses. I've added support for this in BlueZ, which UPower then picks up for desktop integration goodness.

There are a number of Bluetooth LE joypads available for pickup, including a few that should be firmware upgradeable. Look for "Bluetooth 4" as well as "Bluetooth LE" when doing your holiday shopping.

gnome-bluetooth work

Finally, this is the boring part. Benjamin and I reworked code that's internal to gnome-bluetooth, as used in the Settings panel as well as the Shell, to make it use modern facilities like GDBusObjectManager. The overall effect of this is, less code, less brittle and more reactive when Bluetooth adapters come and go, such as when using airplane mode.

Apart from the kernel patch mentioned above (you'll know if you need it :), those features have been integrated in UPower 0.99.7 and in the upcoming BlueZ 5.48. And they will of course be available in Fedora, both in rawhide and as updates to Fedora 27 as soon as the releases have been done and built.

GG!

13 comments:

Paulo Roberto de Oliveira Castro said...

I could pay for the ability to sync the DS4 by connecting the USB cable and pressing the PS button.

Bastien Nocera said...

It already works in Fedora, look at the previous blog post. Did you still want to send money? :)

Arek Rusi said...

There is any chance similar work for xbox1s's gamepad?

Bastien Nocera said...

The XBox One Bluetooth controllers currently can't connect to a Linux Bluetooth adapter. It'll have to wait until we get to the bottom of that, which could be a while. Look for updates on the linux-bluetooth mailing-list.

Arek Rusi said...

Oh it works for me pretty well with two hacks, but i've got the point.
Thanks for answer

Paulo Roberto de Oliveira Castro said...

Yes I do

Paulo Roberto de Oliveira Castro said...

Why isn't this work upstream?

Bastien Nocera said...

> Yes I do

You do what?

> Why isn't this work upstream?

Why doesn't what work upstream?

Anyway, all the code is upstream, best ask your distribution to integrate the patches, they'll know where to get them.

Paulo Roberto de Oliveira Castro said...

I do want to send money. How can I do it? Do you support patreon or something like that?

About the upstream, what I mean is that this functionality isn't available on Arch Linux with the lastest GNOME Shell release. Do I need to wait until 3.28 is released?

Bastien Nocera said...

Paulo: I'm already paid to work on this. But if you're feeling generous, there's a wishlist in the sidebar of my site. Don't go breaking the bank though.

The functionality is in BlueZ git, which will soon be released as 5.48. If there's a recent snapshot in Arch, you can probably use that, as the functionality has been in there for about a month.

Sanket Dhole said...
This comment has been removed by a blog administrator.
vkolotov said...

Hi @Bastien, thank you for your work. A lot of people using Bluez and what you do guys is awesome. The new battery service looks good to me. However, looks like the very last changes that add this new BDus interface (v5.48) removes the battery service from the list of discovered services which breaks some software that relies on it. It is basically not available anymore to read Battery Level nor to subscribe to notification to receive Battery level updates... I'm a developer of a Bluetooth plugin for the OpenHab Framework by using the TinyB library (a wrapper around Bluetooth DBus interface), and with the Bluez upgrade the TinyB library no longer returns Battery service along with other GATT services. I'm wondering if it is a bug or it is intentional behaviour? Thanks, Vlad.

Bastien Nocera said...

@vkolotov: I don't understand what changes you're talking about. Please report any bugs you see to the linux-bluetooth mailing-list.