Projects tagged ‘python’ and ‘usb’


Jump to tag:

Projects tagged ‘python’ and ‘usb’

Filtered by Project Tags python usb

Refine results Project Tags linux (7) windows (5) pygtk (4) serial (3) libusb (3) mcu (3) portable (2) hid (2) device (2) measurements (2) gpib (2) hardware (2)

[25 total ]

2 Users

IntroductionThis project aims to be a simple USB/HID user application space (hence no drivers needed) 100% python package. Initially targeting simple HID devices management, also planed is support ... [More] for WinUSB high level wrapping. The vision for this project is to be something similar to PySerial or PyParallel for USB/HID hardware enthusiasts. AdvantagesAll python code, using ctypes Top level handling of HID events (usage events calling hook handlers) LimitationsDepending on your application you might find these limitations Windows only (so far...) Not so fast top level interfacing. But you could still access your raw data reports. InstallationNo package releases yet. I expect to have it working by using easy_install. For now you can access the code using the svn repository. I'm planning initially to have a mature pywinusb.hid name space (sub-package) implementation before attempting the pywinusb.winusb stuff. Using the packageCheck the .\examples\hook_button.py script, it shows how to use usage event handlers, also the .\examples\simple_send.py script describes how to toggle a usage signal by using output reports. In general this is you'll usually follow this steps: Import the pywinusb.hid subpackage: from pywinusb import hidDefine a HidDeviceFilter() object to target a particular USB device. The most restrictions you add when initializing the object, the narrower your device search might be, examples: # any hid device filter = hid.HidDeviceFilter() # just by vendor id filter = hid.HidDeviceFilter(vendor_id = 0x1234) # using vendor id and product id filter = hid.HidDeviceFilter(vendor_id = 0x1234, product_id = 0x0001) # by getting a range of vendor id's (example 0x12??) filter = hid.HidDeviceFilter(vendor_id = 0x1234, product_id = 0x0001, vendor_id_mask = 0xff00) # or particular product_id range (0x001??) all_devices = hid.HidDeviceFilter(vendor_id = 0x1234, product_id = 0x0010, product_id_mask = 0x0010)Then at some point you'd poll for device availability, the reason for this is that you could receive plug and play events when any HID device gets connected or disconnected # poll now all_devices = filter.get_devices() if all_devices: print "Found %d matching hid devices" % len(all_devices)You´ve got to be carefull on the filter result, if your search is wide enough to match multiple devices, might end up with more than expected items, there are other reasons you might actually get more than expected items returned by HidDeviceFilter().get_devices() Obviously, multiple devices might be connected to different USB ports. 2. You could have HID devices with multiple collections, the usages spread over different usage pages, or the way the HID descriptors are arranged causes Windows to report your devices as multiple hid devices (istead of a single HID instance), as if it were a composite device. For both cases you might find out that the HidDeviceFilter().get_devices_by_parent() very useful, it will return a dictionary where the keys make reference to the actual hardware instance ID of the parent device, so, this will effectevely group the found hid devices by the top level parent device. The dictionary values will be a list containing the devices with the common parent hardware ID. HidDeviceFilter().get_devices_by_parent() support the same parameters get_devices() does. # example, handle the HidDeviceFilter().get_devices() result grouping items by parent ID all_hids = HidDeviceFilter().get_devices_by_parent() for parent, hid_items in al_hids.items(): print "Hid devices having hardware (instance) parent id = %d:" % parent for item in hid_items: print "\t%s" % repr(item)Once you decide you have something usefull to do with your HID items, you have to call HidDevice.open() to start a data reading thread and be ready to send output reports, if you find out that afte opening your device you get flooded with un-expected data, or just want to send output or feature reports, use the output_only = True parameter. # let's supposed we already have a HidDevice instance, open it and print the vendor_name string hid_device.open(): if hid_device.vendor_id: # effectevely we could open the device (and setup the reading thread) print "The vendor name of device %s is %s" % (repr(hid_device), hid_device.vendor_name) # don't forget to clean up! hid_device.close()Always use HidDevice.close(), this will kill the reading thread and restore the system resources, use a try: finally block to make sure the related system resources are cleaned up in case of any failure during initialization Sending reports. Check the ./examples/simple_send.py script, after opening your HID device, you need to get a target output or feature report, take a look at the HidDevice().find_output_reports() and find_feature_reports() functions, you could search for all reports (no parameters), or provide a target usage_page and usage_id to look for. # let´s find out all the HID usages in all the output reports for report in my_hid_device.find_output_reports(): print "The report %s, has this usage items:" % repr(report) for item in report: print "\t%s" % repr(item) # how about looking for a particular usage in all output reports? target_usage = hid.get_full_usage_id(0x08, 0x36) #page_id = LED page, usage = Play LED # all user space HID devices all_devices = HidDeviceFilter().get_devices() for device in all_devices: # browse each one... try: device.open() #consider using open(output_only = True) for report in device.find_output_reports(): if target_usage in report: # hey, we found any one! report[target_usage] = 1 # change value in report report.send() #flush it! finally: device.close()Finally, you could setup event handler functions to be informed when a particular usage changed, take a look at the hid.HID_EVT_XXXXX constants. So far, you could setup events that would call your event handler function for 0 values (hid.HID_EVT_CLEAR), 1 values (hid.HID_EVT_SET), changing to 0 (hid.HID_EVT_RELEASED), changing to 1 (hid.HID_EVT_PRESSED), just changed (hid.HID_EVT_CHANGED) or when any value is received (hid.HID_EVT_ALL), take a look at the .\examples\hook_button.py script UtilitiesMore on this later... If you actually prepared any documentation, feel free to contribute! The module pywinusb.hid.tools contains a function to check HID class devices capabilities, it issues a text report (see the hid.core package, run it as main) Feedback and ContributingFeel free to contact me (rene f aguirre gmail com)!, just tell what do you think about the project or bring me anything you think might be cool. I´ve being thinking about how to get a entry level HID device, so I could add more examples on such hardware, I was thinking about the Wiimote, but saddly it's rather limited for this, it's not using a proper HID descriptor, so input reports are raw reports. Anyway, if you find (or want to send me, why not), a device that might fit this purpose, just let me know. Any participation it's appreciated, if you are willing to contribute but don't have any ideas or time, feel free to donate. [Less]
Created 7 months ago.

2 Users
 

The liveusb-creator is a cross-platform tool for easily installing live operating systems on to USB flash drives.
Created about 1 year ago.

2 Users

DescriptionBased on and inspired by Apple's Time Machine backup system. Mime is a backup program written in Python that will perform an initial full system backup to any mounted drive that is ... [More] formatted to a standard Linux/Unix file system that supports hard links. All successive backups will create full incremental system images, thus allowing multiple versions of files to exist on the backup media. The package also includes a powerful command line utility called lsmime for listing, restoring and deleting files from your backups. If you have more than one system in your home or office, each system can use the same backup media to backup their data without interrupting data backed up from the other systems. [Less]
Created 12 months ago.

1 Users

Python libraries to interface to GPIB/IEEE-488 instruments, as well as others. Control, fetch measurements, and report. Uses unit objects.
Created 8 months ago.

1 Users

PyPert is a high-level interface to the Pertelian X2040 USB LCD display (http://pertelian.com/). It relies on PySerial. Also included in this project are various uses of PyPert. For example, displaying a list of your friends on Xbox Live.
Created about 1 year ago.

1 Users

Instead of using your i-buddy (http://www.i-buddy.com) with MSN Messenger, why not use it to show other info? With pybuddy, you can control your i-buddy to do any of the supported actions: change head ... [More] color, blink its heart, beat its wings, ... Example uses are: monitoring a website traffic (404s in red, 500s beating wings, 200s in green, ...), showing your project's continuous integration process, ... DependenciesThe daemon is written in python, runs on Linux and needs python-usb. Software using pybuddyBeside the scripts published in the contrib directory, there is other software using pybuddy: Jabbim, a Jabber/XMPP client. Mimics i-buddy MSN Messenger behaviour. [Less]
Created 12 months ago.

0 Users

In anticipation of the soon to be shipping Optimus Mini Three, a spot to build and collect some python-based tools to work with this new toy. The configuration software that will ship with the device ... [More] is reported to be Windows only. Looking to build a set of tools that will work on other platforms or offer an alternative to the supplied software. Nothing but dreams of animated buttons for now. [Less]
Created 11 months ago.

0 Users

The aim of this project is to build a hardware device pluggable to a computer, featuring touch sensors monitored by the device and filtered by the a computer application so as to control iTunes-like ... [More] applications playback. We hope to put all of our project documentation and resources here. This technological project (PT in french) is made by In Ho Doh, Gautam Lele, Arul Nautiyal and Jonathan-David Schröder in Ecole Centrale d'Electronique in the Embedded Systems majeure on S2 of 2008. [Less]
Created 12 months ago.

0 Users

Access Akai Z4/Z8 samplers filesystem and System Exclusive functionality through USB. Includes a FUSE based filesystem implementation, OSC support and a preliminary pygtk UI.
Created 5 months ago.

0 Users

EN: QtADSL, is an ADSL program developed for usb modems. TR: QtADSL, usb modemler için geliştirilen ADSL bağlantı programıdır. SVN: http://qtadsl.googlecode.com/svn/trunk Screenshots:
Created 12 months ago.