Questions tagged [pyusb]

PyUSB is a Python library allowing easy USB access. Make sure to provide all relevant details like exact versions of the operating system, PyUSB library and libusb backend you are trying to use.

PyUSB is a Python library allowing easy USB access. It has the following features:

  • Support for libusb 0.1, libusb 1.0 and OpenUSB.
  • Easy API to communicate with devices.
  • Support for custom library backends.
  • Isochronous transfer type support.
  • 100% written in Python by ctypes.
  • It runs on any Python version >= 2.4 (this includes Python 3).
259 questions
1
vote
1 answer

PyUSB: detect device unplug

I want my program to exit, whenever the device gets unplugged. My code: device = usb.core.find(idVendor, idProduct) device.detach_kernel_driver(0) usb.util.claim_interface(device, 0) usb_cfg = device.get_active_configuration() usb_interface =…
sackratte
  • 11
  • 2
1
vote
1 answer

LibUSB ErrNo 16 Resource Busy - Magstripe reader

I am using a rPi 2B to which I have plugged in a Magstripe Card Reader (using a PS/2 to USB converter). I determined the correct Vendor/Product ID's using lsusb and then am using the following code which uses libusb to connect to the reader. This…
Matthew
  • 9,851
  • 4
  • 46
  • 77
1
vote
1 answer

Trouble using PyUSB to read/write from usb device (timeouts)

I am trying to interface with a device connected to my Ubuntu 16 system(Python ver 2.7.12). When I try to write to the device, I am getting a write timeout (similar with reading from the device). According to what little documentation I have, the…
RichP
  • 67
  • 1
  • 3
  • 13
1
vote
1 answer

PyUSB: Why are bus.dirname and dev.filename empty string?

I am very new to using PyUSB. I have some USB devices connected to my machine and am trying to get some of their properties. Based on what I have learnt from other examples using PyUSB, I have produced a short program in Linux. Here is a snip of…
YvonneH
  • 75
  • 6
1
vote
1 answer

How to control the LED on an xbox 360 gamepad using pyusb

I'm looking to use pyusb to interact with a wired xbox 360 gamepad. So far I can read just fine but I'd also like to write so I can make the LED stop blinking. Looking here, I should be able to do it, but no matter what messages I try sending, I'm…
Mike Lawrence
  • 1,641
  • 5
  • 20
  • 40
1
vote
1 answer

Using python to simulate USB keyboard

I'm well aware of different automation libraries that I can use in conjunction with Python (or even as a separate program/entity all together)-- that's not what I need here... Here's what I'd like to accomplish... {COMP1} --------> {COMP2} (1)…
Doug E Fresh
  • 319
  • 3
  • 8
1
vote
1 answer

Raspberry Pi talking together using USB

I want to develop a PyUSB program which listens to data from USB. However, I wish to expand the application to talk another Raspberry Pi through USB port. I wonder is it possible?
Duy Nguyen
  • 31
  • 3
1
vote
0 answers

AttributeError: function 'usb_detach_kernel_driver_np' not found

I've been trying to print a simple receipt with an Epson TM-t20ii using Python 2.7 and python-escpos. installed the printer drivers, also copied the libusb 1.2.6 .sys and .dll files to their respective folder. Heres how the program looks like: from…
Ale Rojas
  • 497
  • 2
  • 7
  • 17
1
vote
1 answer

Python PyUSB HID Feature Report

I am accessing a USB HID Device using python hidapi from a Mac OSX 10.10.5 doing: import hid import time hidraw = hid.device(0x1a67, 0x0004) hidraw.open(0x1a67, 0x0004) # Rpt, GnS, Tgt, Size, Index LSB, Index MSB, Data #…
faturita
  • 115
  • 4
  • 9
1
vote
1 answer

Communicating to USB devices in windows 7 and still use pre-existing drivers?

I'm looking to write a program to change the DPI setting on my logitech G502 mouse (My goal being to use the program with AutoHotkey to help automate a task where I switch my DPI allot and to learn a bit about USB). I'm fairly fluent in C++ , C# and…
1
vote
0 answers

PyUSB communication with Raspberry Pi and custom temp / humidity sensor

I have: USB HID raw temp/humidity sensor raspberry Pi B I want: python to get data from USB sensor on the PI With the help of several different web pages and some answers on this site, I have found the device, I can show the interface details and…
orob
  • 11
  • 1
  • 3
1
vote
0 answers

Getting error 'Endpoint' object has no attribute ctrl_transfer when trying to get string descriptor using pyusb

I am attempting to get the string descriptor of the Endpoint attribute bmAttributes. I am able to get the value using pyusb but not the string descriptor for it. When i do i get that error. dev = usb.core.find(idVendor =…
mri3
  • 256
  • 3
  • 18
1
vote
0 answers

PyUSB ask for device Status

I'm trying to write a script for barcode printers. Here is my Code: def printLabel(barcode, qty, articlenr=''): dev = findPrinter() dev.write("") return True if __name__ =="__main__": for i in range(2): try: #…
Sativa
  • 348
  • 1
  • 2
  • 14
1
vote
0 answers

PyUSB does not get response from XBox One Controller

I am trying to read from a Xbox One Controller responses from its keys. I have already found its IdVendor and IdProduct using dev = usb.core.find(find_all=True) This controller works fine on Ubuntu since I use it in Steam, so there is no problem…
Abend
  • 589
  • 4
  • 14
1
vote
2 answers

Persistent error coming from libusb0

I'm using a Python application that accesses a USB device (pipsta printer) and executes a routine. It's running fine outside the container, but when it comes to the container it returns a error like this: (File …
Alex Frois
  • 21
  • 3