USB in python

Diez B. Roggisch deets at
Thu Jan 22 11:15:58 CET 2009

Astan Chee wrote:

> Hi,
> 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.

This doesn't sound like an USB-device to me. The USB-standard defines a
serial line protocol, where of course the state of the TX-line is set to
whatever the protocol dictates. And as not all of the things put out on the
line are of the programmer's own doing, it will be on and off all the time.

And no piece of software is going to control that - it's already implemented
in the USB-host-controllers inside your computer.

Even with a considerably more primitive RS233 line you'd not stand a chance
with that design.

Unless I'm not getting something here.

I've created USB-devices based on the AT90USB1287 from Atmel, and there you
can of course use the libusb (and it's wrapping PyUSB) to acccess the
device, and e.g. drive a single port-pin of the uC high - to activate,
whatever you want to activate.


More information about the Python-list mailing list