Re: USB in python



Astan Chee schrieb:
Diez B. Roggisch wrote:
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.
Unless I'm not getting something here.


Hi,
Thanks for all the responses but I forgot to mention that I have very little hardware understanding (at least in english) and the device itself it very simple and only needs about 5V power to be active. The problem here is that I want to control when the device is active using a computer so I thought USB might be a good choice since its simple (but didn't turn out to be). I'm open to any other suggestions on how I might achieve this hardware and software-wise (as in what interface should I use, etc). Also I'm trying to stay away from (complex) micro controllers.
Any ideas?

Others suggested the parallel port. It is the natural choice for such things, with two caveats:

- it is legacy, and thus often not available on modern hardware, especially on mobile ones. So if you want it be prepared to additionally buy a usb2parallel-adapter.

- it's electrical specs aren't as robust I fear. USB allos up to 500mA to be drawn, and shouldn't break if you try more & fail (albeit, that might be something that isn't true all the time). So you can draw quite a bit of current from it (the stupid USB-cup-warmers are an example of that). I have often had broken parallel-ports, and I think the reason is that they *ARE NOT* specified to drive anything - they only provide low-current control-lines. So whatever you design, you need a second power-source then.

All in all, using a USB-controller is IMHO the best solution. The AT90USBKey is a low-cost evaluation-board. ATMEL provides quite a bit of example-code, and there is other FOSS available.

I have to admit though that the whole USB-topic isn't the easiest thing.


Diez
.



Relevant Pages

  • Re: iomega 2TB external USB drive
    ... hdc: drive not ready for command ... usb 1-4: new high speed USB device using ehci_hcd and address 21 ...
    (Debian-User)
  • Re: Single axis stepper controller w/single programmable relay output?
    ... the guys who know more about specifically USB to explain if they like. ... I know if I send a signal to a pin on a hardware LPT port it (barring ... Stage), most USB control messages entail a handshake and a Data Stage, ...
    (rec.crafts.metalworking)
  • Re: Unknown USB Device
    ... This seems to indicate that your USB ports may not be able to provide enough ... Are you connecting the drive to a HUB or a direct USB port on the PC? ... USB Device ... > Found New Hardware: ...
    (microsoft.public.windowsxp.hardware)
  • Re: Simtec v Castle USB
    ... If said hardware fails to work, ... >> from when the first USB device classes and interface guidelines were ... > Who says that all USB devices follow the guidelines? ... > their products to work on Windows. ...
    (comp.sys.acorn.hardware)
  • Word crashes on opening (but opening .doc files works)
    ... it crashes before even showing up on the menu bar ... PCI Card: usb, usb, SLOT-4 ... USB Device: MITSUMI USB FDD, MITSUMI, Up to 12 Mb/sec, 500 mA ...
    (comp.sys.mac.apps)