From owner-freebsd-hackers Wed Feb 19 13:53:21 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id NAA21419 for hackers-outgoing; Wed, 19 Feb 1997 13:53:21 -0800 (PST) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by freefall.freebsd.org (8.8.5/8.8.5) with SMTP id NAA21401 for ; Wed, 19 Feb 1997 13:53:09 -0800 (PST) Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id WAA16687; Wed, 19 Feb 1997 22:52:56 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.8.5/8.6.9) id WAA23717; Wed, 19 Feb 1997 22:43:26 +0100 (MET) Message-ID: Date: Wed, 19 Feb 1997 22:43:26 +0100 From: j@uriah.heep.sax.de (J Wunsch) To: dario@escher.usr.dsi.unimi.it (Dario Maggiorini) Cc: freebsd-hackers@freebsd.org Subject: Re: parallel read References: <199702191142.DAA18699@freefall.freebsd.org> X-Mailer: Mutt 0.55-PL10 Mime-Version: 1.0 X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199702191142.DAA18699@freefall.freebsd.org>; from Dario Maggiorini on Feb 19, 1997 12:37:49 +0100 Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk As Dario Maggiorini wrote: > has anyone of you already > > 1 - modified the parallel driver Dunno. > 2 - a pointer to some kind of documentation Add the desired input function as an ioctl into lptioctl. You're going to read 4 or 5 bits a time only, so you can conveniently pass them back to the caller within a single `int' value. I wouldn't bother setting up a lptread() function for this. > 3 - write asm code to access directly the memory location > ( i believe it's possible but can't write it by myself, i'm in a hurry > and has no time to learn asm details ) No need for hairy asm details. They are well-hidden from you, you're only operating with C or pseudo-C code at the driver level. All you need is a single inb() call. Have a look into /sys/i386/isa/lpt.c, and you should figure this out within an hour, provided you've got reasonable understanding of C coding. The ioctl command names for lpt(4) are defined in /sys/i386/include/lpt.h, so they are usable as #include from a userland program. Simply add there a: #define LPT_READSTAT _IOR('p', 2, int) /* get status bits */ Remember that your calling program must pass the _address_ of an int: #include #include ... int status, fd; if ((fd = open(PATH_LP, O_RDONLY)) == -1) { err(...); } ... if (ioctl(fd, LPT_READSTAT, &status) == -1) { err(1, "Can't read status"); } -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)