pyusb

OUT Endpoint not accessible by pyusb

六月ゝ 毕业季﹏ 提交于 2019-12-08 08:07:32
问题 I am trying to send num lock to my custom hardware acting as a HID Keyboard. I have tied up an LED to glow if the num lock key is received on the USB. It works fine for numlock keypress from external keyboard. But I am unable to send the num lock key manually through pyusb (0x01) This is the part of the code responsible for sending it: dev = usb.core.find(idVendor=0xXXXX, idProduct=0xXXXX) try: dev.set_configuration() except usb.core.USBError as e: print e #endpoint = dev[0][(0,0)][0] # get

How to interact with USB device using PyUSB

假装没事ソ 提交于 2019-12-08 01:26:00
问题 I have so far gotten to the stage of finding the device, now I am ready to talk to the USB using the devices protocol laid out in the specification on page 22. libusb is installed on my machine and so is PyUSB. import usb.core import usb.util # find our device dev = usb.core.find(idVendor=0x067b, idProduct=0x2303) # was it found? if dev is None: raise ValueError('Device not found') # b are bytes, w are words reqType = '' bReq = '' wVal = '' wIndex = '' dev.ctrl_transfer(reqType, bReq, wVal,

Sending data via USB using PyUSB

时光怂恿深爱的人放手 提交于 2019-12-06 11:19:11
I need to send data via USB using Python, I'm using PyUSB (http://sourceforge.net/apps/trac/pyusb/) I look for any USB port available, and I tried to send a message: devList = usb.core.find(find_all=True) for dev in devList: for cfg in dev: for intf in cfg: sys.stdout.write('\t' + str(intf.bInterfaceNumber) + ',' + str(intf.bAlternateSetting) + '\n') for ep in intf: sys.stdout.write('\t\t' + str(ep.bEndpointAddress) + '\n') if ep.bEndpointAddress: try: dev.write(ep.bEndpointAddress, 'test', intf.bInterfaceNumber) except Exception: print "\t\terror : dev.write("+str(ep.bEndpointAddress)+",

How to interact with USB device using PyUSB

怎甘沉沦 提交于 2019-12-06 08:12:36
I have so far gotten to the stage of finding the device, now I am ready to talk to the USB using the devices protocol laid out in the specification on page 22. libusb is installed on my machine and so is PyUSB. import usb.core import usb.util # find our device dev = usb.core.find(idVendor=0x067b, idProduct=0x2303) # was it found? if dev is None: raise ValueError('Device not found') # b are bytes, w are words reqType = '' bReq = '' wVal = '' wIndex = '' dev.ctrl_transfer(reqType, bReq, wVal, wIndex, []) The above example is attempting to use a control transfer, which I assume is what the

Pyusb on Windows 7 cannot find any devices

你说的曾经没有我的故事 提交于 2019-12-06 05:51:39
问题 So I installed Pyusb 1.0.0-alpha-1 Under Windows, I cannot get any handles to usb devices. >>> import usb.core >>> print usb.core.find() None I do have 1 usb device plugged in(idVendor=0x04d8, idProduct=0x0042), and I tried usb.core.find(idVendor=0x04d8, idProduct=0x0042) but that failed too. Under Ubuntu, with the same versions of pyusb and python (2.6), I am able to successfully find my device with that code, and communicate with it. So how can I get pyusb to find usb devices on Windows 7?

Pyusb on windows 8.1 - no backend available - how to install libusb?

℡╲_俬逩灬. 提交于 2019-12-05 03:49:39
问题 Working on pyinstaller 3.1, python 2.7.9, and tkinter. Try to use pyusb instead of pyserial, but no backend available. Looking into Pyusb on windows - no backend available, PyUSB ValueError: No backend available, USB interface in Python, and so on, it seems that I need to install libusb. But when I run "import usb" and "import usb.core" under python, no errors. I have no idea how to install it and how to use it in my project, how to tell my project where libusb is. what I did: (1) download

How can I get raw USB keyboard data with Python?

懵懂的女人 提交于 2019-12-04 10:01:31
I am using PyUSB in Python as I will have to listen an USB port to retrieve data from an electronic card. For the moment, I have to train myself by reading direct input from a small keyboard (USB-connected) connected to a Raspberry-Pi. Of course, I do not want to read the typed String, I expect to get ASCII codes for example. I just don't get how I could read input from my USB-keyboard. I already found some snippets : import usb.core import usb.util VENDOR_ID = 0x0922 PRODUCT_ID = 0x8003 # find the USB device device = usb.core.find(idVendor=VENDOR_ID, idProduct=PRODUCT_ID) # use the first

How to reverse engineering USB/HID/BlueTooth dongle. What tools to use?

久未见 提交于 2019-12-03 17:43:58
问题 Need to reverse engineering bluetooth usb mouse dongle, and use mouse board to measure distance, and plot them with matplotlib I've found these tools that can help with this task: Linux lsusb usbmon usbhid-dump rfcomm hidrd-convert xxd hcitool evdev-dump Windows usblyser Bibliography: https://www.silabs.com/Support Documents/TechnicalDocs/AN249.pdf www.usb.org/developers/devclass_docs/HID1_11.pdf Usbhid-dump - digimend Linux, HID and PyUSB MagTek Credit Card Reader in Linux Evdev-dump -

How to reverse engineering USB/HID/BlueTooth dongle. What tools to use?

怎甘沉沦 提交于 2019-12-03 06:23:21
Need to reverse engineering bluetooth usb mouse dongle, and use mouse board to measure distance, and plot them with matplotlib I've found these tools that can help with this task: Linux lsusb usbmon usbhid-dump rfcomm hidrd-convert xxd hcitool evdev-dump Windows usblyser Bibliography: https://www.silabs.com/Support Documents/TechnicalDocs/AN249.pdf www.usb.org/developers/devclass_docs/HID1_11.pdf Usbhid-dump - digimend Linux, HID and PyUSB MagTek Credit Card Reader in Linux Evdev-dump - digimend Examples: lnx#> lsusb -s 2 Bus 005 Device 002: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth

PyUSB dev.set_configuration()

匆匆过客 提交于 2019-12-01 08:49:06
I am trying to send data to a usb stick using the python library PyUSB. The code I am using is the following: import usb.core import usb.util # find our devices #dev = usb.core.find(idVendor=0xfffe, idProduct=0x0001) dev = usb.core.find(idVendor=0x090c, idProduct=0x1000) # was it found? if dev is None: raise ValueError('Device not found') # set the active configuration. With no arguments, the first # configuration will be the active one dev.set_configuration() # get an endpoint instance cfg = dev.get_active_configuration() interface_number = cfg[(0,0)].bInterface_number alternate_setting = usb