我正在尝试读取我的耳机公开的各种服务的值,但我尝试的每个 UUID 都给我相同的结果"Failed to read: org.bluez.Error.Failed"
;
命令手动执行链:
sudo 蓝牙控制
信息
Device 6C:D3:EE:6E:B9:15 (public)
Name: Redmi Buds 4 Pro
Alias: Redmi Buds 4 Pro
Class: 0x00240404
Icon: audio-headset
Paired: yes
Trusted: yes
Blocked: no
Connected: yes
LegacyPairing: no
UUID: Vendor specific (00000000-0000-0000-0099-aabbccddeeff)
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: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
UUID: A/V Remote Control (0000110e-0000-1000-8000-00805f9b34fb)
UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb)
UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb)
UUID: Generic Access Profile (00001800-0000-1000-8000-00805f9b34fb)
UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)
UUID: Device Information (0000180a-0000-1000-8000-00805f9b34fb)
UUID: Unknown (0000af00-0000-1000-8000-00805f9b34fb)
UUID: Unknown (0000fd2d-0000-1000-8000-00805f9b34fb)
UUID: Vendor specific (0000ff01-0000-1000-8000-00805f9b34ff)
UUID: Vendor specific (5052494d-2dab-0341-6972-6f6861424c45)
Modalias: bluetooth:v0094p0004d0100
Battery Percentage: 0x64 (100)
菜单关贸总协定
属性信息
Characteristic - Model Number String
UUID: 00002a24-0000-1000-8000-00805f9b34fb
Service: /org/bluez/hci0/dev_6C_D3_EE_6E_B9_15/service0060
Flags: read
选择属性 00001200-0000-1000-8000-00805f9b34fb
读
Attempting to read /org/bluez/hci0/dev_6C_D3_EE_6E_B9_15/service0060/char0063
Failed to read: org.bluez.Error.Failed
答案1
我能够使用gdbus
bluez api 将方法和属性作为对象获取,使用以下命令:
gdbus introspect --system --dest org.bluez --object-path /org/bluez/hci0/dev_6C_D3_EE_6E_B9_15
类似地,可以使用以下方法访问内部 UUID
gdbus introspect --system --dest org.bluez --object-path /org/bluez/hci0/dev_6C_D3_EE_6E_B9_15/service0060/char0063
并通过以下方式调用他的方法:
gdbus call --system --dest org.bluez --object-path /org/bluez/hci0/dev_6C_D3_EE_6E_B9_15 --method org.bluez.MediaControl1.VolumeDown
可以使用 bluetoothctl 获取 /bluez/path。
这个 stackOverflow 答案是先前命令的来源
仍然无法读取值