设备/操作系统:Jetson Nano/Ubuntu 18.04
Python 3
已连接蓝牙适配器。
以及当我这样做时:
$ hcitool con
Connections:
> ACL B8:78:26:19:C1:8C handle 11 state 1 lm MASTER AUTH ENCRYPT
和
$ bt-device -l
Added devices:
Joy-Con (R) (B8:78:26:19:C1:8C)
我已经安装了https://github.com/trezor/cython-hidapi使用说明从源代码(我在构建期间尝试了 hidraw 和 libusb API。
在这两种情况下,这个简单的代码:
import hid
devices = hid.enumerate(0, 0)
print(devices)
仅打印连接到设备的有线 USB 鼠标和 USB 键盘:
[
{'path': b'0001:0006:00', 'vendor_id': 1118, 'product_id': 203, 'serial_number': '', 'release_number': 256, 'manufacturer_string': '', 'product_string': '', 'usage_page': 0, 'usage': 0, 'interface_number': 0},
{'path': b'0001:0004:00', 'vendor_id': 1008, 'product_id': 36, 'serial_number': '', 'release_number': 304, 'manufacturer_string': '', 'product_string': '', 'usage_page': 0, 'usage': 0, 'interface_number': 0}
]
最佳答案
解决方案是使用 udev rules 。 These rules在我的案例中有效。
我最终还使用了不同的 Python 库 https://github.com/apmorton/pyhidapi 。但我确信原来的 cython-hidapi 也可以。
关于python - 我无法使用 cython-hidapi 库看到蓝牙设备 (Joy-Con),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62419920/