chromeos & bluetooth audio: jiggle the handle

Santa seems to have grown weary of watching me get my earbuds torn from my head by passing doorknobs and cupboard fixtures so he very generously provided me with a nice set of bluetooth headphones this year. They paired flawlessly to my phone before I'd even descended the subway on my way back from Best Buy Santa's workshop, but when I got them home they flat out refused to pair to my Chromebook.

The official state of Bluetooth audio on ChromeOS seems to be a bit dubious, it's implied that "certain devices" are supported but it seems to be uncertain exactly which devices or to what extent. I did find a post in the chromebook-central Google group who seemed to have my specific model of headphone, and chromebook, and bluetooth issue. The advice offered wasn't very helpful.

I haven't the faintest idea what is happening behind the scenes when a device is selected for pairing in the ChromeOS UI, but the output of bluetoothd looks like this (spoiler: shit ain't happenin).

Fortunately as usual if you bash around in bash long enough you can make the aforementioned shit happen. This will probably not work on a stock, non-rooted chromebook.

First if you haven't already removed failed pairing attempts do so. YMMV (your MAC may vary).

chronos@localhost / $ sudo bluetoothctl  
[NEW] Controller 5C:F8:A1:AA:BB:CC Chromebook [default]
[bluetooth]# remove 0C:E0:E4:XX:YY:ZZ 

I dunno how it was previously, but with via BlueZ 5's bluetoothctl tool all known MAC addresses can be tab completed. Mmm dat user experience tho!

Adding it The Right Way.

[bluetooth]# agent on
Agent registered  
[bluetooth]# default-agent on
Default agent request successful  
[bluetooth]# scan on
Discovery started  
[CHG] Controller 5C:F8:A1:AA:BB:CC Discovering: yes

At this point put your headphones into pairing mode, in my case this means turn 'em on but hold the power button for a few moments longer.

[bluetooth]# pair 0C:E0:E4:XX:YY:ZZ
Attempting to pair with 0C:E0:E4:XX:YY:ZZ  
[CHG] Device 0C:E0:E4:XX:YY:ZZ Connected: yes
[CHG] Device 0C:E0:E4:XX:YY:ZZ Modalias: bluetooth:v0055pD005d0400
[CHG] Device 0C:E0:E4:XX:YY:ZZ UUIDs:
[CHG] Device 0C:E0:E4:XX:YY:ZZ Paired: yes
Pairing successful  
[CHG] Device 0C:E0:E4:XX:YY:ZZ Trusted: yes
[CHG] Device 0C:E0:E4:XX:YY:ZZ Connected: no

I dunno if mine is showing Trusted: yes because it's cached somehow so if you don't get that right away you may need to run [bluetooth]# trust <mac address>. At this point you should be able to connect.

[bluetooth]# connect 0C:E0:E4:XX:YY:ZZ 
Attempting to connect to 0C:E0:E4:XX:YY:ZZ  
[CHG] Device 0C:E0:E4:XX:YY:ZZ Connected: yes
Connection successful  

From here on a regular linux distro you'd need to start screwing with the audio settings to select the now connected headphones as the default audio device, but the cras audio server seems to work this out on it's own. If you see the norse kings initials or whatever on the right side of your volume bar you're in business.

I figured I'd need to do this every time I wanted to connect but it seems to persist through powering off the headphones as well as rebooting the lappy. If you're not as lucky and want to script these steps this forum post seems like a good place to start.