linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bit by bit parallel port  control
@ 2004-10-11 14:10 Tony Howat
  2004-10-11 15:01 ` Jan-Benedict Glaw
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Howat @ 2004-10-11 14:10 UTC (permalink / raw)
  To: linux-kernel

Hi Everyone,

I'm having problems controlling the parallel port on a bit-on bit-off basis 
for a relay switch on a control project.

Linux marmot 2.6.5-1.358 #1 Sat May 8 09:04:50 EDT 2004 i686 athlon i386 
GNU/Linux

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...

I figured the lp module may interfere, so removed that. No help. Currently 
lsmod shows:

w83781d                26240  0
i2c_sensor              2176  1 w83781d
i2c_amd756              4484  0
i2c_core               16388  3 w83781d,i2c_sensor,i2c_amd756
autofs4                10624  0
sunrpc                101064  1
forcedeth              10624  0
floppy                 47440  0
sg                     27552  0
scsi_mod               91344  1 sg
dm_mod                 33184  0
ati_remote              9228  0
ohci_hcd               14748  0
button                  4504  0
battery                 6924  0
asus_acpi               8472  0
ac                      3340  0
ext3                  102376  3
jbd                    40216  1 ext3

Board is an ASUS A72N266VM (nforce based). Build is fedora 2. I'm not 
running lpd or X etc. Any suggestions?

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

I suspect there's something odd going on. I aim to try the code on an older 
machine soon.

Any help or pointers appreciated,

--
Tony


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bit by bit parallel port  control
  2004-10-11 14:10 Bit by bit parallel port control Tony Howat
@ 2004-10-11 15:01 ` Jan-Benedict Glaw
  0 siblings, 0 replies; 2+ messages in thread
From: Jan-Benedict Glaw @ 2004-10-11 15:01 UTC (permalink / raw)
  To: Tony Howat; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1591 bytes --]

On Mon, 2004-10-11 15:10:13 +0100, Tony Howat <tony@i-r-genius.com>
wrote in message <20041011141018.M62685@i-r-genius.com>:
> 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@lug-owl.de    . +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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-10-11 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-10-11 14:10 Bit by bit parallel port control Tony Howat
2004-10-11 15:01 ` Jan-Benedict Glaw

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).