索尼 BRH10,长相如下
主要看中这货有上下左右方向键,它跟 Android 手机连接后,可以当一个简单的遥控器使用,已经测试 OK。
现在我想在树莓派上写个程序,来响应它的各按键。
目前已经完成配对:
[bluetooth]# info 30:A8:xx:xx:xx:xx Device 30:A8:xx:xx:xx:xx Name: BRH10 Alias: BRH10 Class: 0x240404 Icon: audio-card Paired: yes Trusted: yes Blocked: no Connected: yes LegacyPairing: yes UUID: Headset (00001108-0000-1000-8000-00805f9b34fb) UUID: Handsfree (0000111e-0000-1000-8000-00805f9b34fb) UUID: Human Interface Device... (00001124-0000-1000-8000-00805f9b34fb) UUID: PnP Information (00001200-0000-1000-8000-00805f9b34fb) UUID: Vendor specific (8e780633-3c51-11e1-8d8d-001cc4d601d8) Modalias: usb:v0FCEpF0FAd0100 [bluetooth]#
一开始以为各按键会产生键盘事件,所以用了以下代码来测试:
from curtsies import Input def main(): with Input(keynames='curses') as input_generator: for e in input_generator: print(repr(e)) if __name__ == '__main__': main()
结果完全没反应。
又想通过 pybluez 的 BluetoothSocket 来连接它,但不知道该用 L2CAP 还是 RFCOMM 协议,每个都瞎折腾了一番,还是没有头绪。
所以想请懂行的朋友指点下,给个大概的方向即可,我再自己去研究,谢谢了!
1 laoyur OP |