Tell me more ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

The Raspi is being promoted as an educational device that primarily uses Python. Inline with this, there are already some great examples online of people accessing the GPIO from Python. However, most off-the-shelf (rather than home brew) peripherals have USB interfaces. How does one go about accessing these using the standard Debian/Python card? Is there a Python library available, and a good tutorial?

share|improve this question
1  
I think this needs to be more specific. What are you trying to do with USB exactly? – Jivings Jun 13 '12 at 21:08
This is a very good question, I have always wondered how to make USB devices. – Shane Hudson Jun 13 '12 at 21:08
1  
The specific application I have in mind is a JMRI type system to access a model railroad DCC controller interface (eg. such as the Digitrax PR3). But that is way too specific for this site! The question is aimed at the lower level "how do I talk to any device on USB from Python" - it is implicitly assumed that the programmer has the protocol documentation for the device they wish to program. – winwaed Jun 13 '12 at 21:12
I'm going to watch this question carefully. I'm looking at two touch panel displays, both with simple ASCII command sets and USB interfaces, which I want to try with the RasPi. – Ray Depew Jun 13 '12 at 22:15

1 Answer

up vote 8 down vote accepted

USB is at heart just a serial communication device. How the data is communicated is standard, but what that data consists of is device dependant. Your controller manufacturer will have invented an api that consists of commands and messages of the form 'do this', or 'this is happening'

If you know this api you should be able to communicate. Two possibly helpful links are

http://sourceforge.net/apps/trac/pyusb/

http://www.digitalmihailo.com/post/usb-programming-with-python-on-linux

A valuable source of information is USB Complete

share|improve this answer
Thanks - yes that is the kind of level I was aiming for my question. Protocols / product APIs for specific peripherals are other questions, or a matter for the vendor's documentation. – winwaed Jun 17 '12 at 22:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.