From: Eric Lammerts <eric@lammerts.org>
To: Uwe Reimann <linux-kernel@pulsar.homelinux.net>
Cc: linux-kernel@vger.kernel.org
Subject: Re: Direct access to parport
Date: Tue, 4 Mar 2003 23:31:52 +0100 (CET) [thread overview]
Message-ID: <Pine.LNX.4.52.0303042329450.18334@ally.lammerts.org> (raw)
In-Reply-To: <3E646091.6070004@pulsar.homelinux.net>
On Tue, 4 Mar 2003, Uwe Reimann wrote:
> I'd like to connect some self made hardware to the parallel port and
> read the values of the dataline using linux. Can this be done in
> userspace or do I have to write kernel code to do so? I'm currently
> thinking of writing a device like lp, which in turn uses the parport
> device. Does this sound like a good idea?
>From userspace it's quite simple:
#include <stdio.h>
#include <sys/io.h>
int main(int argc, char **argv)
{
int addr = 0x378;
if(ioperm(addr, 3, 1) == -1) {
perror("ioperm");
exit(1);
}
printf("0x%02x\n", inb(addr + 1));
}
The ioperm() only works if you're root.
Eric
next prev parent reply other threads:[~2003-03-04 22:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-04 8:15 Uwe Reimann
2003-03-04 22:31 ` Eric Lammerts [this message]
2003-03-05 6:49 ` Peter Svensson
2003-03-05 11:24 ` Dmitrii Tisnek
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.52.0303042329450.18334@ally.lammerts.org \
--to=eric@lammerts.org \
--cc=linux-kernel@pulsar.homelinux.net \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®