透過 bluetoothctl 終端連接時無法讀取設備的屬性值

透過 bluetoothctl 終端連接時無法讀取設備的屬性值

我正在嘗試讀取耳塞公開的各種服務的值,但我嘗試的每個 UUID 都給我相同的結果"Failed to read: org.bluez.Error.Failed"

命令手動執行鏈:

須藤藍牙ctl

資訊

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

我能夠使用gdbusbluez 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

/bluez/path 可以使用 bluetoothctl 取得。

這個 stackOverflow 答案是之前命令的來源

仍然無法讀取值

相關內容