Bluetooth headset battery level linux

Check Bluetooth headphones battery status in Linux

Is it possible to get the battery status of Bluetooth headphones connected to Linux? Android shows it so I was wondering if it was possible.

6 Answers 6

I am not sure about the state under Ubuntu, but under Arch Linux you do not need to write your own scripts to get bluetooth battery information nowadays.

The bluez package has experimental support for querying bluetooth headset battery data. Simply enable experimental features by editing

Then, you just need to restart the bluetooth service using

systemctl restart bluetooth 

Reconnect to your device, and

should now also show the battery status. e.g.

Device 28:11:A5:47:6C:6E (public) Name: Cloud Walker Alias: Cloud Walker Class: 0x00240418 Icon: audio-headphones Paired: yes . Battery Percentage: 0x3c (60) 

The solution using upower as given by danjjl should also work now.

And now the battery level percentage should show up in Gnome Power settings dialog as well.

Thanks, just got this working on Arch thanks to your answer! It also gets it showing in the Power settings UI for Gnome too! Ubuntu must have enabled the Experimental bit in their upstream of bluez . I just added some UI screenshots as well as example output from bluetoothctl info . Oddly though, bluetoothctl info only shows one device, e.g. not my MX Master mouse battery as well. I’m looking forward to these battery levels showing natively in the system tray settings dropdown too!

I wrote a simple python script that does the job. It uses AT commands to communicate with the device via RFCOMM and prints the battery level if the device is supported.

(You need Python 3.6.0 or newer to run the script)

It might not work with all bluetooth headsets but I’ve provided a couple of workarounds in the ‘Issues’ page that might help.

@Qui-GonJinn it’s a command line tool. It simply prints the battery level, for example something like this: Battery level for XX:YY:ZZ:AA:BB:CC is 80%

Using port .2 I get is offline (16, ‘Device or resource busy’) . Using other ports I get is offline (111, ‘Connection refused’) .

In ubuntu you can go simply to settings->power to see the battery status of system and connected devices.

enter image description here

Yes, I know it’s a Microsoft Bluetooth mouse on a Linux System . but hey, Microsoft is the new cool company now 😉

This is what: systemctl status bluetooth

enter image description here

This is what: bluetoothctl devices shows:

enter image description here

The JBL was disconnected and the Creative speaker is connected with power. So the resulting ones with batteries (Keychron and Mouse) show up in the settings->power dialog.

Читайте также:  Programming software on linux

NOTE: If upower -d not show the device, It’s power level may not display in settings .
// I had a mouse shown, but a headphone not.

Unfortunately, I don’t see the first section «Devices» on my machine. I’ve the same Ubuntu20.04.1 LTS.

Hmm, seems you don’t have any connected devices. Probably a last check if BT stack is running. You can check it with systemctl status bluetooth Which should state loaded and active. If that is the case you can use bluetoothctl which open an internal cli. Enter devices which should give a list of the connected devices. I add the outputs for my system in the answer above.

Seems to be dependent on the device. I found the issue and comment from the maintainer below in the gnome.org gitlab issues Source,see here: Quote: «.. the device needs to show up in the output of upower -d to show up in the Power Settings panel (whether that’s a laptop or a desktop). Right now, this means only devices which export their battery status in the kernel, and Bluetooth LE devices which export the battery via the BATT profile are supported...»

upower can be used from a terminal to list power devices, listening to device events and querying history and statistics.

If your device is listed by upower -e you can run upower —dump to retrieve the battery level of your device.

$ upower --dump . Device: /org/freedesktop/UPower/devices/mouse_dev_C1_FC_26_13_A9_58 native-path: /org/bluez/hci0/dev_C1_FC_26_13_A9_58 model: MX Anywhere 2S serial: C1:FC:26:13:A9:58 power supply: no updated: Wed 31 Dec 1969 06:00:00 PM CST (1550719462 seconds ago) has history: yes has statistics: no mouse present: yes rechargeable: no state: unknown warning-level: none percentage: 50% icon-name: 'battery-missing-symbolic' . 

Источник

Проверьте состояние батареи наушников Bluetooth в Linux

Возможно ли получить состояние батареи наушников Bluetooth, подключенных к Linux, Android показывает это, поэтому мне было интересно, если это было возможно??

6 ответов

Я не уверен насчет состояния в Ubuntu, но в Arch Linux в настоящее время вам не нужно писать собственные сценарии для получения информации о батарее Bluetooth.

Пакет bluez имеет экспериментальную поддержку запроса данных о батарее Bluetooth-гарнитуры. Просто включите экспериментальные функции, отредактировав

Затем вам просто нужно перезапустить службу Bluetooth, используя

systemctl restart bluetooth 

Повторно подключитесь к устройству и

теперь также должен показывать состояние батареи. например

Device 28:11:A5:47:6C:6E (public) Name: Cloud Walker Alias: Cloud Walker Class: 0x00240418 Icon: audio-headphones Paired: yes . Battery Percentage: 0x3c (60) 

Решение с использованием upower, предложенное danjjl, теперь также должно работать.

И теперь процент уровня заряда батареи также должен отображаться в диалоговом окне настроек Gnome Power.

Я написал простой скрипт на Python, который выполняет эту работу. Он использует AT-команды для связи с устройством через RFCOMM и печатает уровень заряда батареи, если устройство поддерживается.

(Для запуска скрипта вам понадобится Python 3.6.0 или новее)

Это может работать не со всеми bluetooth-гарнитурами, но на странице «Проблемы» я предложил несколько обходных решений, которые могут помочь.

Читайте также:  Start http server linux

В Ubuntu вы можете просто перейти в settings->power чтобы увидеть состояние батареи системы и подключенных устройств.

Да, я знаю, что это Bluetooth-мышь Microsoft в системе Linux. но, эй, Microsoft теперь новая крутая компания;)

upower может использоваться с терминала для составления списка устройств питания, прослушивания событий устройства и запроса истории и статистики.

Если ваше устройство указано upower -e Вы можете запустить upower —dump чтобы узнать уровень заряда батареи вашего устройства.

$ upower --dump . Device: /org/freedesktop/UPower/devices/mouse_dev_C1_FC_26_13_A9_58 native-path: /org/bluez/hci0/dev_C1_FC_26_13_A9_58 model: MX Anywhere 2S serial: C1:FC:26:13:A9:58 power supply: no updated: Wed 31 Dec 1969 06:00:00 PM CST (1550719462 seconds ago) has history: yes has statistics: no mouse present: yes rechargeable: no state: unknown warning-level: none percentage: 50% icon-name: 'battery-missing-symbolic' . 

Источник

Check Bluetooth headphones battery status in Linux

Solution 3: can be used from a terminal to list power devices, listening to device events and querying history and statistics. This is what: This is what: devices shows: The JBL was disconnected and the Creative speaker is connected with power.

No Bluetooth Found — Plug in a dongle to use Bluetooth

First, run this command for switching on devices

sudo systemctl restart bluetooth 

for checking status of your, Bluetooth run this

systemctl status bluetooth 

You can simply try to perform a cold reboot. It worked in my case.

Besides trying all suggestions out there, the only thing that really fixed the issue for me was to update my BIOS to the most recent version.

Essentially follow the following steps:

  1. Download the BIOS from your hardware provider[Intel in my case]. Save it onto a USB drive.
  2. Reboot your machine and and press F7 during boot. This key might be different based on your hardware.
  3. Select the bios file you’d downloaded and let the bios upgrade. On reboot your Bluetooth should be back and functional.

Check Bluetooth headphones battery status in Linux, The bluez package has experimental support for querying bluetooth headset battery data. Simply enable experimental features under /etc/bluetooth/main.conf by setting Experimental=true Then, you just need to restart the bluetooth service using systemctl restart bluetooth Reconnect to your …

Check Bluetooth headphones battery status in Linux

I wrote a simple python script that does the job. It uses AT commands to communicate with the device via RFCOMM and prints the battery level if the device is supported.

(You need Python 3.6.0 or newer to run the script)

It might not work with all bluetooth headsets but I’ve provided a couple of workarounds in the ‘Issues’ page that might help.

In ubuntu you can go simply to settings->power to see the battery status of system and connected devices.

Yes, I know it’s a Microsoft Bluetooth mouse on a Linux System . but hey, Microsoft is the new cool company now 😉

This is what: systemctl status bluetooth

This is what: bluetoothctl devices shows:

The JBL was disconnected and the Creative speaker is connected with power. So the resulting ones with batteries (Keychron and Mouse) show up in the settings->power dialog.

Читайте также:  File caching in linux

NOTE: If upower -d not show the device, It’s power level may not display in settings .
// I had a mouse shown, but a headphone not.

upower can be used from a terminal to list power devices, listening to device events and querying history and statistics.

If your device is listed by upower -e you can run upower —dump to retrieve the battery level of your device.

$ upower --dump . Device: /org/freedesktop/UPower/devices/mouse_dev_C1_FC_26_13_A9_58 native-path: /org/bluez/hci0/dev_C1_FC_26_13_A9_58 model: MX Anywhere 2S serial: C1:FC:26:13:A9:58 power supply: no updated: Wed 31 Dec 1969 06:00:00 PM CST (1550719462 seconds ago) has history: yes has statistics: no mouse present: yes rechargeable: no state: unknown warning-level: none percentage: 50% icon-name: 'battery-missing-symbolic' . 

Sound — Bluetooth headset not working in 20.04, I had the exact same situation upgrading from 19.10 to 20.04 with a HP laptop and Skullcandy Bluetooth headphones: Using the sound panel and changing the output to the headphone does not work. However using the pulse-audio volume control and switching the output to the headphone redirect the …

Cannot find Bluetooth device — Ubuntu Core on Raspberry PI 3 B+

There is a bug and it is using wrong firmware dir. As temporary fix you can use this command:

sudo ln -s /lib/firmware /etc/firmware 
sudo hciattach /dev/ttyAMA0 bcm43xx 921600 - 

Headphones Not Detected in Ubuntu, First, it is suggested that you click the blue button on the right side of your output device where the headphones are plugged, to set this device as the default output for new applications — on my setup you can see that the last device is actually chosen as the default output (it is my dock).

18.04: Bluetooth device does not appear in gnome-control-center

The bluetooth service needs to be running for gnome-control-center to use bluetooth.

Check the status of bluetooth service

# systemctl status bluetooth ● bluetooth.service - Bluetooth service Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2020-01-31 09:32:02 EST; 1h 1min ago Docs: man:bluetoothd(8) Main PID: 8880 (bluetoothd) Status: "Running" Tasks: 1 (limit: 4915) CGroup: /system.slice/bluetooth.service └─8880 /usr/lib/bluetooth/bluetoothd Jan 31 09:32:02 ubuntu-1804-laptop systemd[1]: Starting Bluetooth service. Jan 31 09:32:02 ubuntu-1804-laptop bluetoothd[8880]: Bluetooth daemon 5.48 Jan 31 09:32:02 ubuntu-1804-laptop systemd[1]: Started Bluetooth service. Jan 31 09:32:02 ubuntu-1804-laptop bluetoothd[8880]: Starting SDP server Jan 31 09:32:02 ubuntu-1804-laptop bluetoothd[8880]: Bluetooth management interface 1.14 initialized Jan 31 09:32:02 ubuntu-1804-laptop bluetoothd[8880]: Endpoint registered: sender=:1.34 path=/MediaEndpoint/A2DPSource Jan 31 09:32:02 ubuntu-1804-laptop bluetoothd[8880]: Endpoint registered: sender=:1.34 path=/MediaEndpoint/A2DPSink 

Bluetooth not working on Ubuntu 16.04 LTS, Your answer is inappropriate in several ways: 1. You don’t know if TLP is installed (not default for most Ubuntu flavours). 2. Instead of uninstalling completely, use the solution from the FAQ. 3. Please don’t suggest installing from source, use the PPA. 4. There is no difference between TLP 0.8 1.0 with …

Источник

Оцените статью
Adblock
detector