Skip to content

Instantly share code, notes, and snippets.

@yosoufe
Last active January 28, 2024 08:49
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save yosoufe/bee3be68fdd29204530b6edf5e416ce0 to your computer and use it in GitHub Desktop.
Save yosoufe/bee3be68fdd29204530b6edf5e416ce0 to your computer and use it in GitHub Desktop.
Increase the volume of Freebuds 3 on Ubuntu 18.04

Disclaimer

This is documentation for myself in hope of helping others. I do not accept any responsibility. Follow the instruction at your own risk. I tested it with Ubuntu 18.04 and it worked. This was also a practice for myself to automate something in Linux.

Solving Freebuds 3 volume problem on Linux

My freebuds 3 had a very low volume on Ubuntu 18.04 until I saw this answer. So running the following command 4 times resolved the issue

dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_<mac_address_of_headphones> org.bluez.MediaControl1.VolumeUp

Just note that the mac address should be seperated with _ underscore rather than : which you may find in the bluetooth settings.

Still the problem is whenever I reconnect the headphones, I have to do this again. So I created a bash function for it.

How to automate it???

The idea is to make Linux run the above command whenever it connects to my very specific Freebuds 3 automatically.

First we need to find information of the bluetooth device. Make sure the bluetooth headphone is not connected. Then run the following command

dmesg --follow

then connect the bluetooth headphone. A new line should be added to dmesg output. For me the new line was like

[ 4036.621181] input: 04:8C:9A:F9:85:9A as /devices/virtual/input/input57

Now to find out more about this device we run

udevadm info -ap /devices/virtual/input/input57

Of course replace the paths with yours. The above command should output like this:

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/virtual/input/input57':
    KERNEL=="input57"
    SUBSYSTEM=="input"
    DRIVER==""
    ATTR{name}=="04:8C:9A:F9:85:9A"
    ATTR{phys}==""
    ATTR{properties}=="0"
    ATTR{uniq}==""

Now we have all the properties of the device. We need ATTR{name}=="04:8C:9A:F9:85:9A" and SUBSYSTEM=="input".

Now we need to write a rule for kernel to execute the volume increase command whenever this bluetooth device is connected. Create a rule file like this:

sudo gedit /etc/udev/rules.d/50-my_bluetooth_rule.rules

add the following content to it and save it, of course replace the attributes value of your device from the udevadm command for yourself:

ACTION=="add", SUBSYSTEM=="input", ATTR{name}=="04:8C:9A:F9:85:9A", RUN+="/home/your_username/bluetooth_rule.sh"

Now we need to create /home/your_username/bluetooth_rule.sh file to be executed whenever the bluetooth device is added.

gedit /home/your_username/bluetooth_rule.sh

And add the following content to it with your MAC addresss replaced, my MAC was 04_8C_9A_F9_85_9A:

Warning: When you run the following script manually, the volume of headphones increases suddenly. So be careful to not run it while you are listening to something. Too high volume may hurt your ears.

#!/bin/bash
for i in {0..3..1}; do dbus-send --print-reply --system --dest=org.bluez /org/bluez/hci0/dev_04_8C_9A_F9_85_9A org.bluez.MediaControl1.VolumeUp; done

The above runs the volume increase command 4 times. That is working for me. Tune it as you wish.

Now we need to reload the rules by running the following command

sudo udevadm control --reload

And that's it. Now whenever you connect the Freebuds 3 it should be at its highest internal volume level.

Extra Resources

I got the above information from these links:

Getting the Bluetooth Mic working with Ubuntu 20.04

I just followed the instruction in this link and everything worked for all of my bluetooth headsets:

@hospadar
Copy link

THANK YOU!
Worked great to fix some super low-volume issues on a jabra elite 75t

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment