如何获取蓝牙设备的电池信息?

如何获取蓝牙设备的电池信息?

我搜索了很多,但还是没有找到解决我所面临问题的正确方法。我想知道是否有办法查看通过蓝牙连接的耳机的电池电量。我已经检查了输出,bluetoothctl它显示了以下信息:

[EDIFIER W800BT]# info
Device 04:FE:A1:E9:70:DE (public)
        Name: EDIFIER W800BT
        Alias: EDIFIER W800BT
        Class: 0x00240404
        Icon: audio-card
        Paired: yes
        Trusted: yes
        Blocked: no
        Connected: yes
        LegacyPairing: no
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: Handsfree                 (0000111e-0000-1000-8000-00805f9b34fb)
[EDIFIER W800BT]# show
Controller 74:40:BB:FE:F3:7C (public)
        Name: kennet
        Alias: kennet
        Class: 0x001c010c
        Powered: yes
        Discoverable: yes
        Pairable: yes
        UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
        UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)
        UUID: OBEX File Transfer        (00001106-0000-1000-8000-00805f9b34fb)
        UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)
        UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)
        UUID: PnP Information           (00001200-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: IrMC Sync                 (00001104-0000-1000-8000-00805f9b34fb)
        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
        UUID: Audio Sink                (0000110b-0000-1000-8000-00805f9b34fb)
        UUID: Vendor specific           (00005005-0000-1000-8000-0002ee000001)
        UUID: Message Notification Se.. (00001133-0000-1000-8000-00805f9b34fb)
        UUID: Phonebook Access Server   (0000112f-0000-1000-8000-00805f9b34fb)
        UUID: Message Access Server     (00001132-0000-1000-8000-00805f9b34fb)
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        Modalias: usb:v1D6Bp0246d0530
        Discovering: no

此外,

➜  ~ hcitool dev
Devices:
        hci0    74:40:BB:FE:F3:7C

另外,我没有找到任何内容:

➜  ~ ls -l /sys/class/bluetooth/hci0/power/
total 0
-rw-r--r-- 1 root root 4096 dez 27 19:11 async
-rw-r--r-- 1 root root 4096 dez 27 19:11 autosuspend_delay_ms
-rw-r--r-- 1 root root 4096 dez 27 19:11 control
-r--r--r-- 1 root root 4096 dez 27 19:11 runtime_active_kids
-r--r--r-- 1 root root 4096 dez 27 19:11 runtime_active_time
-r--r--r-- 1 root root 4096 dez 27 19:11 runtime_enabled
-r--r--r-- 1 root root 4096 dez 27 19:11 runtime_status
-r--r--r-- 1 root root 4096 dez 27 19:11 runtime_suspended_time
-r--r--r-- 1 root root 4096 dez 27 19:11 runtime_usage

答案1

按照安装指南使用此扩展对我有用。 https://github.com/MichalW/gnome-bluetooth-battery-indicator

相关内容