python pyusb库使用教程【在window10系统上操作USB】(操作Intel Realsense D435)
生活随笔
收集整理的這篇文章主要介紹了
python pyusb库使用教程【在window10系统上操作USB】(操作Intel Realsense D435)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
發現位置:usb之python(pyusb)
pypi:pyusb 1.0.2
Libraries.io教程 :pyusb Release 1.0.2
github教程:Programming with PyUSB 1.0
我的安裝流程:參考tensorflow-yolov3 調試Intel Realsense D435攝像頭所遇到的問題(USB自動檢測并重置機制)
查看idVendor和idProduct
根據作者提供的github教程:
測試打印usb接口信息
隨機挑選一個Intel Realsense攝像頭,根據它的idVendor和idProduct打印它的信息:
發現深度攝像頭都是一樣的:
RGB攝像頭都是一樣的:
運行代碼
# -*- coding: utf-8 -*- """ @File : test_191128_測試pyusb.py @Time : 2019/11/28 11:24 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """ import usb.core import usb.util# find our device dev = usb.core.find(idVendor=0x8086, idProduct=0x0B07)print(dev)結果:
D:\20191031_tensorflow_yolov3\python\python.exe D:/20191031_tensorflow_yolov3/needed/test/test_Intel_realsense/test_191128_測試pyusb.py DEVICE ID 8086:0b07 on Bus 001 Address 014 =================bLength : 0x12 (18 bytes)bDescriptorType : 0x1 DevicebcdUSB : 0x320 USB 3.2bDeviceClass : 0xef MiscellaneousbDeviceSubClass : 0x2bDeviceProtocol : 0x1bMaxPacketSize0 : 0x9 (9 bytes)idVendor : 0x8086idProduct : 0x0b07bcdDevice : 0x50b6 Device 80.116iManufacturer : 0x1 Error Accessing StringiProduct : 0x2 Error Accessing StringiSerialNumber : 0x3 Error Accessing StringbNumConfigurations : 0x1CONFIGURATION 1: 110 mA ==================================bLength : 0x9 (9 bytes)bDescriptorType : 0x2 ConfigurationwTotalLength : 0xb77 (2935 bytes)bNumInterfaces : 0x5bConfigurationValue : 0x1iConfiguration : 0x0 bmAttributes : 0xc0 Self PoweredbMaxPower : 0x37 (110 mA)INTERFACE 0: Video =====================================bLength : 0x9 (9 bytes)bDescriptorType : 0x4 InterfacebInterfaceNumber : 0x0bAlternateSetting : 0x0bNumEndpoints : 0x1bInterfaceClass : 0xe VideobInterfaceSubClass : 0x1bInterfaceProtocol : 0x0iInterface : 0x5 Error Accessing StringENDPOINT 0x87: Interrupt IN ==========================bLength : 0x7 (7 bytes)bDescriptorType : 0x5 EndpointbEndpointAddress : 0x87 INbmAttributes : 0x3 InterruptwMaxPacketSize : 0x40 (64 bytes)bInterval : 0x6INTERFACE 1: Video =====================================bLength : 0x9 (9 bytes)bDescriptorType : 0x4 InterfacebInterfaceNumber : 0x1bAlternateSetting : 0x0bNumEndpoints : 0x1bInterfaceClass : 0xe VideobInterfaceSubClass : 0x2bInterfaceProtocol : 0x0iInterface : 0x5 Error Accessing StringENDPOINT 0x82: Bulk IN ===============================bLength : 0x7 (7 bytes)bDescriptorType : 0x5 EndpointbEndpointAddress : 0x82 INbmAttributes : 0x2 BulkwMaxPacketSize : 0x400 (1024 bytes)bInterval : 0x0INTERFACE 2: Video =====================================bLength : 0x9 (9 bytes)bDescriptorType : 0x4 InterfacebInterfaceNumber : 0x2bAlternateSetting : 0x0bNumEndpoints : 0x1bInterfaceClass : 0xe VideobInterfaceSubClass : 0x2bInterfaceProtocol : 0x0iInterface : 0x8 Error Accessing StringENDPOINT 0x83: Bulk IN ===============================bLength : 0x7 (7 bytes)bDescriptorType : 0x5 EndpointbEndpointAddress : 0x83 INbmAttributes : 0x2 BulkwMaxPacketSize : 0x400 (1024 bytes)bInterval : 0x0INTERFACE 3: Video =====================================bLength : 0x9 (9 bytes)bDescriptorType : 0x4 InterfacebInterfaceNumber : 0x3bAlternateSetting : 0x0bNumEndpoints : 0x0bInterfaceClass : 0xe VideobInterfaceSubClass : 0x1bInterfaceProtocol : 0x0iInterface : 0x6 Error Accessing StringINTERFACE 4: Video =====================================bLength : 0x9 (9 bytes)bDescriptorType : 0x4 InterfacebInterfaceNumber : 0x4bAlternateSetting : 0x0bNumEndpoints : 0x1bInterfaceClass : 0xe VideobInterfaceSubClass : 0x2bInterfaceProtocol : 0x0iInterface : 0x6 Error Accessing StringENDPOINT 0x84: Bulk IN ===============================bLength : 0x7 (7 bytes)bDescriptorType : 0x5 EndpointbEndpointAddress : 0x84 INbmAttributes : 0x2 BulkwMaxPacketSize : 0x400 (1024 bytes)bInterval : 0x0Process finished with exit code 0看不懂這打印的一堆是啥玩意o_o …
然后運行dev.set_configuration(),報錯:
usb.core.USBError: [Errno 2] Entity not found
不丸了(╯‵□′)╯︵┻━┻
總結
以上是生活随笔為你收集整理的python pyusb库使用教程【在window10系统上操作USB】(操作Intel Realsense D435)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python os.popen()方法(
- 下一篇: windows下如何查看设备的idVen