USB in python

Tim Roberts timr at probo.com
Mon Jan 26 05:46:44 CET 2009


Astan Chee <astan.chee at al.com.au> wrote:
>
>Im trying to write a program for my USB device and I'm thinking of using 
>python to do this. The USB device is of my own making and it is 
>activated when one of the two data pins of the USB is given about 5V (or 
>similar to whatever the power pin is getting). Now I'm confused to if 
>the software to activate this can actually be written and how do I do 
>it? Any examples? I've seen pyUSB but it doesn't give me control over 
>the hardware and how much power is going through the data pins.

Sorry, but you have NOT created a USB device, and I sincerely hope you do
not try to plug it in to a real USB port.

Despite the "serial" in the name, USB is much more than just a pair of
wires, like RS-232.  USB is a standard protocol-based bus, like Ethernet,
and anything that is plugged into it must follow the protocol.  You don't
get a "voltage", you get a 480 MHz differential digital signal train.  The
wires are controlled by a USB host controller.  You cannot override its
behavior.

You might be able to achieve your goal by using a parallel port, or by
using a USB-to-serial port adapter, or by using one of the many simple and
affordable USB experimenter's kits in the world.
-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.



More information about the Python-list mailing list