Phyton USB Devices Driver



Latest version

Python Usb Devices Driver Adapter

The documentation for the nidaqmx Python package is hosted on the NI Github Sit. It includes all of the nidaqmx Python example programs, and the function definitions Install Python and the NI-DAQmx Python API: Download Python; Install python; Go to ezsetup.py source code page here; Copy everything and paste it in a new notepad file.

Released:

  1. Driver install for Windows 8.1: After 'Driver Signature Enforcement' has been disabled open Device Manager: Make sure your pyboard is connected, it should be displayed under 'Other Devices'. (Driver is installed on the caption so it is placed where it will end up once the driver is installed). Right click your pyboard and select update driver.
  2. The basic idea was to control different measurement devices, the easy part was RS232 communication with python but for further usage it was necessary to control measurement devices with USB connection too. PyUSB (https://walac.github.io/pyusb/).

A package that simplifies USB/HID communications on windows

Project description

Table of Contents

  • Introduction
  • Installation Instructions
  • Using pywinusb.hid
  • Release changes

Introduction

This project aims to be a simple USB/HID user application space (hence no systemdrivers needed) 100% python package (without C extensions). Initially targetingsimple HID devices management.

The vision for this project is to be something similar to PySerial or PyParallelbut for USB/HID hardware enthusiasts.

Advantages

  • All python code, using ctypes
  • Top level handling of HID events (usage events calling hook function handlers)

Current limitations

Depending on your application you might find these limitations

  • Windows only (so far…)
  • Maybe speed. I’ve had feedback by some users that speed is not a problem for high data throughput, but I think you might hit some Python limits if you are require any real time processing.

Installation Instructions

Phyton USB Devices Driver

Windows

The most convenient way of installing is using easy_install or pip, Irecommend to do this once you are familiar with the library as you might loosetrack of the example source files, but you can take a look to the example orthe source browsing the github repository.

If using a source package (.zip) from PyPi un-zip your file, or get the sourcefrom the main repository and run the familiar setup.py install command lineis sufficient, setuptools or distribute (for python 3) are required.

Using pywinusb.hid

View the ./examples directory for some (ok, few right now) scripts. Theseshow, for instance, how to use pywinusb.hid to handle events from HID classdevices usages events.

Latest code and some Wiki information can be found on the main project code page.

Utilities

More on this later…

  • The module pywinusb.hid.tools contains a function to check HID class devicescapabilities, for now it provides a basic human readable text report (seethe hid.core package, run it as main while HID class devices are connectedto your system)

Feedback and Contributing

Feel free to contact me! use the main code project page, just tell what doyou think about the project or bring me anything you think might be cool toconsider.

Any participation it’s appreciated, feel free to contribute more examples or applications or just a reference to your open source project that uses the library.

Release changes

[Next release]

  • Fixed issue #33. Allow to read totally unparsed reports.

0.4.2

  • Issue #33.
  • PR #39. Intermittent lockup on close.

0.4.1

  • Patched ctypes issue on Python 3.5.1 64 bits.

0.3.7

Phyton USB devices driver
  • Added PySide PnP example.

0.3.5

  • Win7/64 PnP example fixed again (due ctypes and Windows 64 API changes).

0.3.4

  • Jeff Rowberg (bluegiga) patch for deamon threads.

0.3.3

  • Win7/64 fixes, PnP example fixed, show_hids.py now using local encodings, stdout encodings now not in library (should be part of applications), usage_pages.py UsagePage repr() fix.

0.3.1

  • Python 2 and 3 support (tested with Python 3.2)

0.3.0

  • Refactored setup api handling.
  • Many PyLint fixes.

0.2.9

  • Fixed broken value array usages transactions
  • Better Setup API device paths handling

Python Usb Devices Driver Logitech

<= 0.2.8

  • Fixed broken value array usages transactions
  • Fixing sending output / feature reports
  • Fixed broken input report handling
  • Stability improvements
  • Tweaked PnP example, added frame closing event handler, so the USB device is closed
  • Report reading threads and device closing optimizations
  • Fixed bugs preventing properly setting report usage variables after a HidReport().get()
  • Fixed raw_data.py example
  • Fixed bug preventing proper value array setting/getting items
  • Fixed deadlock when device unplugged
  • Added HidDevice.set_raw_data_handler(), and corresponding raw_data.py example script
  • Fixing output only mode (no input report for forced open)
  • Bringing a little bit of stability
  • Output only mode (no reading thread configured)
  • Kind of usable now

Project details


Release historyRelease notifications | RSS feed

0.4.2

0.4.1

0.4.0

0.3.6

0.3.5

0.3.4

0.3.3

0.3.2

0.3.1

0.2.9

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pywinusb, version 0.4.2
Filename, sizeFile typePython versionUpload dateHashes
Filename, size pywinusb-0.4.2.zip (61.7 kB) File type Source Python version None Upload dateHashes
Close

Python Usb Devices Driver Vga

Hashes for pywinusb-0.4.2.zip

Hashes for pywinusb-0.4.2.zip
AlgorithmHash digest
SHA256e2f5e89f7b74239ca4843721a9bda0fc99014750630c189a176ec0e1b35e86df
MD589effe9a46f9a8641993a9de2fb5fb5d
BLAKE2-25638b4ecce4a3a0dac3b1bf5776943530cf4f36406fc9b3f4f3c31c8dcab2249eb

Table of Contents

Phyton USB devices driver
  • PyVISA and the NI-VISA Library on Windows
  • Python and Libusb with Linux

Finding USB Busses and Devices

  • For Linux, use lsusb to list usb busses and devices connected to them. The command, lsusb -v will provide much information. Then use lsmod to list the kernel modules loaded. Note that LinuxCommand.Org explains shell commands.

Instrument USB Interfaces

  • The USB test and measurement specifications provide the information necessary to communicate with compliant instruments. The GPIB over USB specifications are commonly used. Perusing these documents, one can readily understand why a dynamic library between Python and libusb or a substantial Python module would be so useful. Once you understand how to achieve communication over USB, then you can send commands and receive data according to the syntax for a particular instrument. An oscilloscope might conform to the Interchangeable Virtual Instruments - Scope Class specifications or the Standard Commands for Programmable Instruments (SCPI).

USB Linux Kernel Drivers

  • To understand device drivers in Linux, buy or download for free the Linux Device Driver book. The USB chapter.
  • Writing a Simple USB Driver by Greg Kroah-Hartman is illuminating.
  • The USBTMC kernel driver is a character device driver for USBTMC compliant instruments and can be downloaded here. This is an attractive solution for low speed communication, but since there is no Python module you will have to use ctypes and read and write to the /dev/usbtmcX files directly.

PyVISA and the NI-VISA Library on Windows

  • PyVisa can be used with XP to communicate with this oscilloscope via USB. As the documentation shows, this is accomplished using a LabView Visa compatible DLL.
  • Tektronix TDS1012B Digital Oscilloscope

    • This Python program acquires a waveform and performs an FFT using the FFT function in the SciPy or numpy packages. The crude tds1012b.py module provides a few functions and classes for the scope. The programming manual for the tds1000/2000 series explains the command sequences.

PyVISA and the NI-VISA Library on Linux

  • As this informative forum exchange shows, this approach can be problematic, at least for Tektronix oscilloscopes.

PySerial

  • The PySerial module provide a simple means to achieve low speed communication using the serial.Serial class with /dev/tty0usb. As an example, channels.py and prologix_usb2gpib.py modules can be used to create a prologix usb to gpib converter object based on the serial.Serial communication channel object. The Prologix USB to GPIB converter uses the FTDI FT232BL USB-Serial (UART) IC to mimic a serial port connection to the GPIB bus, thus requiring the use of the pyserial module. Upon enumeration, the FT232 usb device is claimed by the kernel modules ftdi_sio and usbserial. You can see if these are loaded by running the lsmod command

Python and Libusb with Linux

  • Libusb provides user-space access to usb devices, and the PyUSB module provides access through Python. The libusb api can be used in lieu of PyUSB documentation. PyLibUSB seems to be similar but uses ctypes. Together with the libusb api, this is an attractive choice.
  • Examples

    • PyUSB can be used to communicate with the prologix device as well, although you have to know much about how the microcontroller uses the IO stream from the FTDI USB chip. The program prologix_pyusb.py finds and claims interface 0 of configuration 1. Note that interface needs to be released from the kernel module that initially claimed the device upon enumeration, presumably ftdi_sio. Also, create or modify /etc/udev/rules.d/11-prologix.rules with GROUP='users' and MODE='0666' so that all users can open the device.

Other Dynamic Libraries, Libusb and Python

Phyton USB Devices DriverUsb

Phyton USB Devices Driver

  • Libftdi uses libusb to talk to FTDI FT232BM/245BM, FT2232C/D and FT232/245R controllers. This is the open-source version of FTDIs libftd2xx. There is said to be a Python module.
  • The LabJack family of USB analog and digital IO devices uses a custom dynamic library to communicate through libusb. Make sure the file /etc/udev/rules.d/10-labjack.rules has GROUP='users' and MODE='0666' so that all users can open the device. With the LabJack disconnected, reload the udev rules using 'udevadm control --reload-rules'. Also, download the source code for exodriver from labjack.com/support and follow the simple installation instructions. Under Linux, the library liblabjack.so (actually a link to the real library liblabjack.so.2.0.1) is in /usr/local/lib, an unusual location. If the 'import LabJackPython' line in a program results in the error 'could not load LabJackUSB driver', do the following. In /etc/ld.so.conf.d create the file labjack.conf. This file has only one line: /usr/local/lib . Then as root, run ldconfig. If in doubt, run 'ldconfig -v | grep labjack', and you should see a statement about liblabjack.so.

Other Dynamic Libraries And Libusb But No Python

Python Usb Device Driver

  • The I2C Tiny USB Project provides a USB interface to an I2C port using the Atmel attiny45.
  • The USB Tiny ISP project provides a USB interface to an SPI port using the Atmel ATTINY2313-20PU.