[time-nuts] OT - USB to LPT Adapter - Does it exist?

Jim Lux jimlux at earthlink.net
Fri Jan 11 15:43:25 UTC 2013


On 1/11/13 7:00 AM, Nathaniel Bezanson wrote:
> J. L. Trantham  wrote:
>> Is there a way to connect a parallel port to a computer via USB?
>> Not a device that shows up as 'USB Print Support' but, instead,
>> shows up in Device Manager as an LPT port?  I have been able to do
>> it via PCMCIA to Parallel Port adapters but I have never found a
>> USB device that would do this.
>
> Nope. Look at how the original PC LPT port works -- it's basically a
> buffer chip or two, connected to some address decoders, sitting at a
> particular spot (0x378) on the CPU's I/O bus. There's simply no way
> to abstract that -- it'd be like asking for USB RAM or a USB BIOS
> chip.

Actually, though, with modern fast computers, it *is* possible to 
abstract it (although tricky and difficult), because the printer port is 
SLOW.
You set up that memory area as protected, so an access causes a trap. 
The kernel fields the trap and does the needed stuff to control your 
fancy LPT port emulator hardware via USB or Ethernet and send/receive 
the bits.

After all, that printer port was designed/specified to talk to devices 
at no more often than 1 microsecond (that is, you could change the state 
of the Strobe line), and practically speaking, with that 4.77MHz ball 
o'fire, the strobe pulse was typically a bit longer.

All those LapLink type cables that did high speed transfers between 
computers using parallel printer ports back to back ran at transfer 
rates around 200 kilotransfers/second, sending 4 bits at a crack each 
way, and that's about as fast as you could bit bang.


Ugly? sure
Pain in the rear to implement in software? yep
Requires a very special hardware interface? Almost certainly.




>
> Software written to bitbang the port will have to be rewritten to use
> some other form of I/O. For the typical cases of bitbang interfacing,
> the FT245R is a very capable little chip, and can be dropped in place
> of the parallel port, to talk to legacy hardware. It just needs new
> software to take those raw IN and OUT instructions and fire them over
> an abstraction layer, which will pass them through the USB stack and
> out to the device.

That is, trap the I/O instructions in userspace and use a kernel driver 
to emulate it.

>
> There is an exception -- If you're running legacy software under a
> modern OS that prevents raw hardware I/O anyway, it's possible to
> hook those IN and OUT instructions, and write a generic driver that
> passes the traffic over USB. It's slow, unstable, and basically a
> miracle if it works. But it's worth a try:
> http://www-user.tu-chemnitz.de/~heha/bastelecke/Rund%20um%20den%20PC/USB2LPT/index.html.en
>

Exactly..





More information about the Time-nuts_lists.febo.com mailing list