Re: Bit by bit parallel port control
From: Jan-Benedict Glaw
Date: Mon Oct 11 2004 - 10:18:12 EST
On Mon, 2004-10-11 15:10:13 +0100, Tony Howat <tony@xxxxxxxxxxxxxx>
wrote in message <20041011141018.M62685@xxxxxxxxxxxxxx>:
> I have tried using the /dev/port method and putb - I can seemingly set bits
> on the port OK. However, checking with a meter shows the line changing for a
> few milliseconds then returning to 0v. I need the levels to hold. I believe
> that's what SHOULD happen...
Don't mess with the hardware on your own! That's almost always a bug and
will cost you any later portability. Instead, just use the interface
Please use the userspace parport driver interface (provided by
ppdev.ko). Additionally it'll give you full portability to non-PC
hardware for free:-)
> There's plenty of sample code around, so I'm pretty confident I'm doing
> things right. My test code is here :
>
> http://www.i-r-genius.com/paralleltest.c
Not all that right:-) You access the hardware directly which is wrong.
Use the ppdev interface instead.
I've just put the program online
(http://lug-owl.de/~jbglaw/software/steckdose/steckdose.c) which
drives my relay box (basically a shift register + relay driver).
I guess the parport locking code isn't yet correct, but it should give
you a start to using ppdev...
MfG, JBG
--
Jan-Benedict Glaw jbglaw@xxxxxxxxxx . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
Attachment:
signature.asc
Description: Digital signature