电脑系统为WIN7 64位

python:为python3.6 32位

需要插件PyUSB-1.0.0.tar,pywinusb-0.4.2。

按照的步骤我偷懒了,自己百度一下。

我们先看设备管理的

测试代码如下

#!/usr/bin/python
# -*- coding:utf-8 -*- import usb.util
import sys
#USB\VID_1C4F&PID_0051
dev = usb.core.find(idVendor= 0x1C4F, idProduct= 0x0051)
if dev is None:
raise ValueError('Device not found')
print(dev)
# set the active configuration. With no arguments, the first
# configuration will be the active one cfg = dev.get_active_configuration()

测试结果

Python 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================== RESTART: C:\Users\libra\Desktop\2222.py ==================
DEVICE ID 1c4f:0051 on Bus 003 Address 002 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x110 USB 1.1
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x8 (8 bytes)
idVendor : 0x1c4f
idProduct : 0x0051
bcdDevice : 0x110 Device 1.1
iManufacturer : 0x1
iProduct : 0x2
iSerialNumber : 0x0
bNumConfigurations : 0x1
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x22 (34 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0xa0 Bus Powered, Remote Wakeup
bMaxPower : 0x32 (100 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x1
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x1
bInterfaceProtocol : 0x2
iInterface : 0x0
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x4 (4 bytes)
bInterval : 0xa

如果先出现系统无法识别的话

可以参考

https://stackoverflow.com/questions/33972145/pyusb-on-windows-8-1-no-backend-available-how-to-install-libusb

I downloaded latest libusb windows binaries from here: http://sourceforge.net/projects/libusb/files/libusb-1.0/libusb-1.0.20/libusb-1.0.20.7z/download then I copied libusb1.dll according to this: when you are on 64-bit Windows, MS64\dll\libusb-1.0.dll must be copied into C:\Windows\System32 and (for running 32-bit applications that use libusb) MS32\dll\libusb-1.0.dll must be copied into C:\Windows\SysWOW64. and then I copied libusb1.lib from binaries to lib dir in python directory and now pyusb works for me. hope it helps.

继续

#!/usr/bin/python
# -*- coding:utf-8 -*- import usb.core
import usb.util
import sys #USB\VID_1C4F&PID_0051
dev = usb.core.find(idVendor= 0x1C4F, idProduct= 0x0051)
if dev is None:
raise ValueError('Device not found')
print(dev)
# set the active configuration. With no arguments, the first
# configuration will be the active one cfg = dev.get_active_configuration()
print("#"*60)
print(cfg)
================= RESTART: C:/Users/libra/Desktop/3333333.py =================
DEVICE ID 1c4f:0051 on Bus 003 Address 002 =================
bLength : 0x12 (18 bytes)
bDescriptorType : 0x1 Device
bcdUSB : 0x110 USB 1.1
bDeviceClass : 0x0 Specified at interface
bDeviceSubClass : 0x0
bDeviceProtocol : 0x0
bMaxPacketSize0 : 0x8 (8 bytes)
idVendor : 0x1c4f
idProduct : 0x0051
bcdDevice : 0x110 Device 1.1
iManufacturer : 0x1
iProduct : 0x2
iSerialNumber : 0x0
bNumConfigurations : 0x1
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x22 (34 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0xa0 Bus Powered, Remote Wakeup
bMaxPower : 0x32 (100 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x1
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x1
bInterfaceProtocol : 0x2
iInterface : 0x0
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x4 (4 bytes)
bInterval : 0xa
############################################################
CONFIGURATION 1: 100 mA ==================================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x2 Configuration
wTotalLength : 0x22 (34 bytes)
bNumInterfaces : 0x1
bConfigurationValue : 0x1
iConfiguration : 0x0
bmAttributes : 0xa0 Bus Powered, Remote Wakeup
bMaxPower : 0x32 (100 mA)
INTERFACE 0: Human Interface Device ====================
bLength : 0x9 (9 bytes)
bDescriptorType : 0x4 Interface
bInterfaceNumber : 0x0
bAlternateSetting : 0x0
bNumEndpoints : 0x1
bInterfaceClass : 0x3 Human Interface Device
bInterfaceSubClass : 0x1
bInterfaceProtocol : 0x2
iInterface : 0x0
ENDPOINT 0x81: Interrupt IN ==========================
bLength : 0x7 (7 bytes)
bDescriptorType : 0x5 Endpoint
bEndpointAddress : 0x81 IN
bmAttributes : 0x3 Interrupt
wMaxPacketSize : 0x4 (4 bytes)
bInterval : 0xa

usb之python(pyusb)的更多相关文章

  1. [开发笔记usbTOcan]PyUSB访问设备

    前面的几个章节的介绍,基本把usbTOcan的底层代码设计好,现在需要介绍PC端的PyUSB进行简单的测试. 在文章开始之前,需要简单的介绍一下整个系统. 0 | 部署 这里使用了两块TM4C123G ...

  2. 学习日志 - Openwrt安装python然后wallproxy

    前提: - 先要把U盘插入路由器的usb口,大多数情况Openwrt都会自动挂载的吧,尽量找当前年或前一年的固件.ssh进路由器,可以看到/mnt/sda1 -  让路由器联网,因为需要从网络上下载安 ...

  3. OPENWRT安装Python到U盘

    http://www.zcilxl.com/tech/23.html 研究了一下如何将软件安装在OPENWRT挂载的U盘上,以Python为例,把过程记录一下. 安装的前提是你的USB设备已经成功挂载 ...

  4. 极路由4pro(HC5962)安装python

    基本配置 其实极路由4.极路由4 pro.极路由B70都是一个型号的(HC5962) CPU:MT7621AT + MT7612EN + 7603EN 内存:256MB DDR3 RAM 闪存:128 ...

  5. Openwrt路由器上安装python

    在路由器安装python之前,还是经过了一番折腾的.淘宝上买了个已经刷好系统的小米迷你路由器,但里面安装的不是预期的Pandorbox,而是LEDE. 这个固件已经带了大量自带的软件,128的内存实在 ...

  6. Python+Appium实现自动抢微信红包

    前言 过年的时候总是少不了红包,不知从何时开始微信红包横空出世,对于网速和手速慢的人只能在一旁观望,做为python的学习者就是要运用编程解决生活和工作上的事情. 于是我用python解决我们的手速问 ...

  7. Openwrt 安装软件到U盘或硬盘

    http://blog.licess.org/openwrt-install-software-to-udisk-harddisk/ 运行一个多月的DDNAS被结婚来玩的小孩给关了,于是趁机更新了一下 ...

  8. python 之serial、pyusb 使用开发

    说明:本次是在windows 系统操作实现的. serial 使用场景,获取得力扫码枪的扫码数据,该扫码枪支持三种通讯接口设置,如下图 即插即用的是 USB-KBW功能,插上去即可获取扫码数据,第二种 ...

  9. windodws pyusb hub端口对应连接的usb设备

    源码: 1 #!/usr/bin/python 2 import sys 3 import usb.core 4 # find USB devices 5 dev = usb.core.find(fi ...

随机推荐

  1. 查AIX 版本和系统参数

    查AIX版本 atii:[/home/pmts]oslevel -s 7100-01-07-1316 即AIX 7.1版本atii:[/home/pmts]lsdev -C 查CPU个数 (逻辑数目) ...

  2. C++11--右值引用(移动语义)

    /*################################################################## * 右值引用 (C++ 11) * 主要用于以下: * 1. ...

  3. 优化 要引入多个 模块 使用调用的方法,让管理更便捷 --execfile() 函数

    1.这里要使用的execfile('a.py') 函数,执行写了引入模块的py. 例子: b.py内容如下: #-*- coding: UTF-8 -*-#调用函数apisys.path.append ...

  4. R语言 实验三 数据探索和预处理

    计算缺失值个数 计算缺失率   简单统计量:计算最值     箱形图分析   分布分析:画出频率直方图 统计量分析:对于连续属性值,求出均值以及标准差         缺失值处理:删除法     去除 ...

  5. js中事件三阶段

    js中事件三阶段 先贴代码: <!DOCTYPE html> <html lang="en"> <head> <meta charset= ...

  6. vmware导出为ovf

        鼠标单击要导出的虚拟机à文件-à导出为OVFà开始导出(耗时有点长)   导出过程     导出的文件格式为:     出现此报错请点击重试 虚拟就就导入了 导入后就可以使用了 vmware1 ...

  7. 微信7.0以上版本fiddler、Charles抓包报HTTPS证书信任问题通报

    通报:微信更新到7.0以后抓包公众号会有证书问题,抓包小程序直接不能打开 各位不用到处找了,也不用怀疑人生了,你没有问题.win10也没有问题.fiddler和Charles也没有问题,是因为微信更新 ...

  8. 协议无关组播--稀疏模式 PIM-SM

    一. 1)PIM-SM 1.PIM-SM转发.加入 PIM-SM适合于接收成员较少的环境.它与DM有何显著的区别?先看PIM-SM转发机制. 转发: 当组播数据到达路由器时,路由器也会去创建转发项.转 ...

  9. Android Gradle插件(plugin)版本(version)与Gradle、SDK Build Tools版本关系

    具体关系如下图: 比如,Android Studio 2.0发布,其中有个新功能“Instant Run”,需要Android Gradle Plugin版本2.0.0以上,那么我们项目的.gradl ...

  10. Pyhton基础知识(一)

    Pyhton基础知识(一)一.cpu 内存 硬盘 操作系统之间的关系1.cpu 中央处理器 运算中心与控制中心 相当于人的大脑.2.内存 暂时存储数据 将应用程序加载到内存 以便于cpu进行数据传输交 ...