DEV Community

Cover image for Pioneer SE-MJ553BT and Archlinux
ugjka
ugjka

Posted on • Updated on

Pioneer SE-MJ553BT and Archlinux

So I have this Pioneer Bluetooth headset that I used mostly with my phones and tablets and it worked perfectly with Android, no problems.

Now I have this Laptop with Arch installed and it has an internal USB Bluetooth adapter. So naturally I wanted to use my headset with this. I use the KDE desktop environment and I had all the GUI Bluetooth stack installed. So I could just from the system tray enable Bluetooth and connect to my Bluetooth devices. This worked fine with Bluetooth keyboards and mice.

Now I tried to connect my headset and initially it would work fine. But shortly after problems started appearing.

If I was playing some audio and stopped for a few minutes and tried to play some audio again it would either switch to HSP/HFP profile for some strange reason or the audio would resume but it would be completely choppy and would stutter a lot. This was unacceptable and useless. I would have to repair my headset every time to get it back in working condition. And at some point even that became unpredictable. I had to investigate...

So? Let's cut the 3 days of debugging, troubleshooting and frustration short and jump to the solutions.

First, uninstall all graphical Bluetooth management programs (Bluedevil, Bluemon, Gnome-Bluetooth)! We are going just use the command line utility bluetoothctl.

You can obtain it by installing bluez bluez-utils.

Now we need to edit the main Bluez configuration file located at /etc/bluetooth/main.conf.

First, change the Name variable to give your adapter a friendlier name otherwise it defaults to 'BlueZ X.YZ'.

Second, scroll down and at the end of the config there's this variable AutoEnable. Uncomment it and set it to true. This will power on our Bluetooth adapter on system startup.

Now we just need to start the Bluez service which you can do by sudo systemctl enable --now bluetooth.service.

Now we can use bluetoothctl to add our headset.

Execute bluetoothctl in your terminal and it will drop into its own shell that has all the commands we need to pair and trust our headset.

Set your headset in pairing mode by holding the power button for 5 seconds and in the Bluetooth shell we power on our adapter and start scanning for devices

$ bluetoothctl 
Agent registered
[CHG] Controller 74:E5:43:B0:48:0C Pairable: yes
[bluetooth]# power on
[CHG] Controller 74:E5:43:B0:48:0C Class: 0x002c010c
Changing power on succeeded
[CHG] Controller 74:E5:43:B0:48:0C Powered: yes
[bluetooth]# scan on
Discovery started
[CHG] Controller 74:E5:43:B0:48:0C Discovering: yes
[NEW] Device 3C:BD:3E:6D:9A:61 MIBOX3
[NEW] Device F4:0E:11:7E:93:EB SE-MJ553BT
Enter fullscreen mode Exit fullscreen mode

Now we see our headset SE-MJ553BT with address F4:0E:11:7E:93:EB. We just now just need to pair, trust and connect it.

[bluetooth]# pair F4:0E:11:7E:93:EB 
Attempting to pair with F4:0E:11:7E:93:EB
[CHG] Device F4:0E:11:7E:93:EB Connected: yes
[CHG] Device F4:0E:11:7E:93:EB UUIDs: 00001108-0000-1000-8000-00805f9b34fb
[CHG] Device F4:0E:11:7E:93:EB UUIDs: 0000110b-0000-1000-8000-00805f9b34fb
[CHG] Device F4:0E:11:7E:93:EB UUIDs: 0000110c-0000-1000-8000-00805f9b34fb
[CHG] Device F4:0E:11:7E:93:EB UUIDs: 0000110e-0000-1000-8000-00805f9b34fb
[CHG] Device F4:0E:11:7E:93:EB UUIDs: 0000111e-0000-1000-8000-00805f9b34fb
[CHG] Device F4:0E:11:7E:93:EB ServicesResolved: yes
[CHG] Device F4:0E:11:7E:93:EB Paired: yes
Pairing successful
[SE-MJ553BT]# trust F4:0E:11:7E:93:EB 
[CHG] Device F4:0E:11:7E:93:EB Trusted: yes
Changing F4:0E:11:7E:93:EB trust succeeded
[CHG] Device F4:0E:11:7E:93:EB ServicesResolved: no
[CHG] Device F4:0E:11:7E:93:EB Connected: no
[bluetooth]# connect F4:0E:11:7E:93:EB 
Attempting to connect to F4:0E:11:7E:93:EB
[CHG] Device F4:0E:11:7E:93:EB Connected: yes
Connection successful
[CHG] Device F4:0E:11:7E:93:EB ServicesResolved: yes
Enter fullscreen mode Exit fullscreen mode

Now we are connected to our headset and it will auto-connect on powering on.

Now to get the audio to work and work properly we need to configure Pulseaudio and disable the power management for our bluetooth adapter as these are the culprits for the aforementioned problems.

First install the pulseaudio-bluetooth package if it is not installed already

Then edit the /etc/pulse/default.pa file and append to the load-module module-bluetooth-policy line this parameter: auto_switch=2

This will make the headset automatically switch to HSP/HFP profile when something requests the microphone input and will switch back to A2DP mode when the microphone is no longer used.

Now find the load-module module-suspend-on-idle line and comment it out. It seems that this line causes a lot of problems for a lot of Bluetooth headsets

### Automatically suspend sinks/sources that become idle for too long
#load-module module-suspend-on-idle
Enter fullscreen mode Exit fullscreen mode

Now we probably also want Pulseaudio to automatically send audio to our headset when it connects, we can do this by adding this to our /etc/pulse/default.pa config

### Automatically switch to newly-connected devices
load-module module-switch-on-connect
Enter fullscreen mode Exit fullscreen mode

Now most of the work is done, we just need to disable power management for our Bluetooth adapter as our headset has a bug when the adapter goes in the suspend mode.

Find vendor and product id for our Bluetooth adapter:

$ lsusb | grep Bluetooth
Bus 002 Device 003: ID 0930:0219 Toshiba Corp. Bluetooth USB Host Controller
Enter fullscreen mode Exit fullscreen mode

In this example vendor id is 0930 and product id is 0219.

Create file /etc/udev/rules.d/70-persistent-bluetooth.rules with your ids from previous step:

# Toshiba Bluetooth.
ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0930", ATTR{idProduct}=="0219", ATTR{power/autosuspend}="0"
Enter fullscreen mode Exit fullscreen mode

Set mode to 644:

chmod 644 /etc/udev/rules.d/70-persistent-bluetooth.rules
Enter fullscreen mode Exit fullscreen mode

You might also need these kernel boot parameters: btusb.force_scofix=1 btusb.enable_autosuspend=0

We should probably clear the ~/.config/pulse/ folder and reboot.

And that should it, power on your headset and you should get proper audio and when the mic is activated you should get the "hands free mode"

If I missed some steps, let me know :)

Discussion (0)