pyusb

PyUSB: reading from a USB device

眉间皱痕 提交于 2020-03-04 05:42:38
问题 This is an updated and shortened question. Communicating with a USB-device should be easy via PyUSB. So, I'm trying to read from a USB-device (oscilloscope) using PyUSB under Win10. Apparently, the USB-driver (libusb-win32 v1.2.6.0) is installed correctly since the device is found and I get some response from print(dev) (see below). From this I can see that the output endpoint address is 0x3 and the input endpoint address is 0x81 According to the Oscilloscope manual, I'm supposed to send

PyUSB device claimed, detach_kernel_driver return Entity Not Found

╄→гoц情女王★ 提交于 2020-01-25 03:45:27
问题 I'm attempting to do bulk reads and writes from a USB device on Ubuntu using PyUSB. However, i've been unsuccessful at getting that far. import usb.core import usb.util dev = usb.core.find(idVendor=0xXXXX,idProduct=0xYYYY) if dev is None: raise ValueError('Device not found.') try: dev.detach_kernel_driver(0) except: print "exception dev.detach_kernel_driver(0)" pass dev.set_configuration() print "all done" This is the simple script I'm using. I've created /etc/udev/rules.d/40-basic-rules

Sending data via USB using PyUSB

ぐ巨炮叔叔 提交于 2020-01-02 18:35:24
问题 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',

Sending data via USB using PyUSB

跟風遠走 提交于 2020-01-02 18:34:13
问题 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',

ImportError: No module named usb.core (Working in terminal, not in Eclipse)

ε祈祈猫儿з 提交于 2020-01-02 07:08:07
问题 I'm trying to get the pyUSB to work on my Ubuntu 14.04 distribution, more specifically in Eclipse. I've installed the package several times using different methods, and the last one combined with some magic did the trick! It is working in the Terminal (see image) But I cannot import the usb.core lib in Eclipse. I still get that error ImportError: No module named usb.core Here is my code: import usb.core dev = usb.core.find(idVendor=0x05fe,idProduct=0x1010) if dev is None: raise ValueError(

Acquiring Images from a USB mouse (Single Chip, ADNS-2700) via pyusb

半城伤御伤魂 提交于 2020-01-01 16:55:53
问题 I would like to extract the actual images captured by a single chip optical mouse sensor, specifically the ADNS-2700. As apposed to the various other tutorials on the internet that use a micro controller to talk to the SPI interface of the imaging chip (like this), the chip I am trying to work with has a USB interface integrated. ADNS-2700 Datasheet System: Windows 7, Python2.7, PyUSB 1.0 I have successfully extracted the button presses, velocity, and scroll wheel following this example:

Why is Python pyusb usb.core access denied due to permissions and why won't the rules.d fix it?

那年仲夏 提交于 2019-12-24 21:29:09
问题 I have a USB device which I'm tring to talk to using pyusb 1.0.2 on linux (Linux tpad 4.15.0-38-generic #41~16.04.1-Ubuntu SMP Wed Oct 10 20:16:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux). Running python 3.5 I get the following error (full trace at bottom of this post): usb.core.USBError: [Errno 13] Access denied (insufficient permissions) Mounting the usb and using lsusb and then inspecting it: udevadm info -a -p $(udevadm info -q path -n /dev/bus/usb/006/011) shows looking at device '

Tkinter and detection of USB devices

喜欢而已 提交于 2019-12-22 18:13:39
问题 I would like to monitor the presence of USB devices and have found modules such as PyUSB that serve this purpose. However, I don't know how to run USB detection services alongside the Tkinter main loop. Is this possible? 回答1: Before starting tk mainloop, start some separate thread that will monitor USBs. Or you can try using tk alarms http://www.pythonware.com/library/tkinter/introduction/x9507-alarm-handlers-and-other.htm to periodically check USB. 回答2: Might I suggest that instead of trying

How can I get raw USB keyboard data with Python?

不问归期 提交于 2019-12-21 18:06:12
问题 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 #

pyusb: cannot set configuration

a 夏天 提交于 2019-12-21 11:25:12
问题 I am trying to make a script (on linux) that can turn a light in my mouse on or off. This is the code I have so far: import usb.core import usb.util import sys interface = 0 dev = usb.core.find(idVendor=0x1532, idProduct=0x0017) def main(): if dev is None: print "device not found" else: print "device found" if dev.is_kernel_driver_active(interface) is True: print "but we need to detach kernel driver" dev.detach_kernel_driver(interface) print "claiming device" usb.util.claim_interface(dev,