需要使用PyBluez在Linux上模拟HID设备。
我有一个HID设备(我要模仿它)。
sdptool browse
命令显示它提供以下服务
Service Name: HID service
Service RecHandle: 0x10001
Service Class ID List:
"Human Interface Device" (0x1124)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 17
"HIDP" (0x0011)
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Human Interface Device" (0x1124)
Version: 0x0101
所以我需要用python创建一个与此等价的服务。
问题是它完全忽略了我提供的Service class ID list
。在
代码如下:
^{pr2}$现在我使用另一个蓝牙适配器运行sdptool
,下面是我看到的
Service Name: PyBluez TEST
Service RecHandle: 0x10011
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 17
Profile Descriptor List:
"Human Interface Device" (0x1124)
Version: 0x0100
服务类ID列表在哪里?
根据this书(第65页),它应该在那里,但它没有。在
这也是HCI配置
hci0: Type: BR/EDR Bus: USB
BD Address: 00:17:9A:3F:54:6F ACL MTU: 1017:8 SCO MTU: 64:0
UP RUNNING PSCAN
RX bytes:37882 acl:320 sco:0 events:949 errors:0
TX bytes:41443 acl:352 sco:0 commands:629 errors:0
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xf9 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'My HID Device'
Class: 0x6e0100
Service Classes: Networking, Rendering, Capturing, Audio, Telephony
Device Class: Computer, Uncategorized
HCI Version: 2.0 (0x3) Revision: 0x403d
LMP Version: 2.0 (0x3) Subversion: 0x430e
Manufacturer: Broadcom Corporation (15)
我很乐意在这方面得到任何帮助。书籍,文件,例子。。。任何东西,可能有助于模拟HID设备。在
**更新**
看来我在连接级别上也有问题。我的HID主机在配对后自动断开连接。在
我的蓝牙适配器是否可以像HID设备一样工作?如何?
您可以使用
sdptool
设置服务类uuid:但它的能力有限。在
我找到了另一种使用dbus-python库发布服务的方法:
下面是XML SDP记录的一个示例:
^{pr2}$相关问题 更多 >
编程相关推荐