I/O Programming usb printer port
I connected an usb printer port to my linux computer. After experimenting on an other computer with a 'normal' printer port, I wanted to try to extend the amount of I/O's using the usb solution.
The default address of the printer port is 0x378 (or 0x278 on some computers). Yes this is the old parallel port and it still works.
But my new computer doesn't have a parallel port. So I bought the usb printer/parallel port.
But now I have to find the address. Let's look at dmesg:
OK, let's look at lsusb -v:
Program I used on the classic port:
If it's not possible to directly address the parallel port, I would like to receive some tips or a workaround.
USB parallel (and other USB dongles) usually include driver software that adapts their proprietary interface to the OS. Using the bare hardware protocols that worked for older hardware is unlikely to work for USB interfaced adapters. There are some such dongles that are advertised as being compatible with various software protection anti-piracy dongles. Such USB-printer ports would probably give you the best hope of working in the way you want, but I wouldn't be making any critical plans based on it.
It's defnitely not SUPPOSED to let you, you're supposed to only read from the /dev file. I'm STILL unclear as to what Linux DOES, because I remember X windows in the old days locking up my system when it probed my video card, when Linux was still, of course, a protected mode system.
If it lets you, well, bad things can obviously happen, since 2 programs can then read or write from it together. Imagine your hard disk :)
I have this article somewhere..... I do not remember the details but it does cover the issues of connecting legacy hardware to your computer.
As already posted a USB parallel port does not work like the hardware device built into the computer.
sudo rmmod lp0
So as to make my USB/parallel port converter function just as a parallel port but I am having a serious problem getting my LED to come on.
USB printer port bitbang
I know well this is an old thread, BUT
I/O (well in this way only OUT) via USB nowadays could be interesting again, because of cheap and common embedded Linux systems which has one or more USB host.
Currently I have a WIFI router and NAS (both are OpenWRT) and these will the base of my home automation system.
Going back to USB parallel port usage as 8 bit output.
Theoretically it could go (I mean the printer port) inward as well but I have not tried.
I got an info in a DicoLitez page, where they use to switch on/off up to 8 lamps via USB parallel port.
It WORKS (8 LEDs lights up and down at my commands) and FAST.
Tomorrow I continue, but now I have to go.
USB printer port bit-level programming SOLUTION
I came back.
So I found a web page:
Where they use USB-LPT converter as 8 bit digital output.
The only trick is a latch IC which "remembers" the last bit configuration.
So my very simple (but working) layout is in the attachment.
- 1 pc 74 HC/HCT 574 - IC,
- 1 pc R - resistor (currently I used 33 Ohm, but depends on LED voltage drop!)
- 8 pcs LED (again, I used 3-3,5 V drop white LED because this was available at home)
From software side you have very few to do:
Just send a character to the appropriate device, like
$> echo -ne "@" > /dev/lp0 # switch on bit 6 LED and switch off all others.
$> cat specially_crafted.txt > /dev/lp0 # you can send whole bunch of characters
Or from programming languages
- Open device filehandle
- write a charact
|All times are GMT -5. The time now is 11:13 AM.|