Accessing a USB Device?

Stephen Horne $$$$$$$$$$$$$$$$$ at $$$$$$$$$$$$$$$$$$$$.co.uk
Wed Oct 15 20:14:30 EDT 2003


On Wed, 15 Oct 2003 20:23:50 +0200, "Josef Meile" <jmeile at hotmail.com>
wrote:

>I'm also interested, but instead of an MP3 device, I want to connect two
>PCs. The problem is that one of the PCs has only a serial port, which must
>be
>used by another application. However, it has lots of USB ports, so I could
>use
>either one USB adapter to RS-232 or a USB to USB cable. As suggested in a
>message from this newsgroup, I tried COM3, which was supposed to be the usb
>port, but it fails, it shows:

Although in hardware terms a USB port is a kind of serial connection,
in software terms there will be a world of difference. There is an
assumption of layers of protocols and indirection which are very hard
to opt out of. USB simply doesn't allow for the
10-minutes-with-a-soldering-iron and a couple of OS calls in the code
approach to custom serial communication.

The reason is that a USB port is primarily because a USB port is
shared resource - you may have it plugged into a hub with several more
devices attached. Ensuring that works correctly means ensuring a rogue
program cannot just hijack the USB port and tell it to do nonstandard
stuff.

A USB port is therefore not going to be visible as a COM port.

You may be able to get a USB device which provides extra serial ports.
It will achieve that by having an installed driver which effectively
creates a virtual COM device in the PC, and transfers the information
from it via the USB cable to the real COM device.

Failing that, I suspect you need to write a driver which fits in with
the OSs way of managing USB, and make a cable with some kind of relay
device that can tell both PCs what the USB cable is doing (so the
correct driver can be identified, installed, and can be given data
recieved from that cable). That doesn't sound to me like a practical
job for most people.

The price of power and flexibility is a loss of simplicity and direct
control.


-- 
Steve Horne

steve at ninereeds dot fsnet dot co dot uk




More information about the Python-list mailing list