From owner-freebsd-questions Tue Jun 22 8:35: 8 1999 Delivered-To: freebsd-questions@freebsd.org Received: from ns2.cyberhost.co.za (ns2.cyberhost.co.za [196.25.117.4]) by hub.freebsd.org (Postfix) with ESMTP id 87F9E151D3 for ; Tue, 22 Jun 1999 08:34:47 -0700 (PDT) (envelope-from andre@ct.paywise.co.za) Fwd-To: questions@freeBSD.org Received: from ct.paywise.co.za (root@ct-dial-7.cyberdial.co.za [196.25.117.39]) by ns2.cyberhost.co.za (8.9.0/8.9.0) with ESMTP id RAA05446; Tue, 22 Jun 1999 17:38:35 +0200 Received: from ct.paywise.co.za (mercury.paywise.co.za [10.10.10.2] (may be forged)) by ct.paywise.co.za (8.9.1/8.9.0) with ESMTP id RAA03521; Tue, 22 Jun 1999 17:13:07 +0200 Message-Id: <199906221513.RAA03521@ct.paywise.co.za> Received: from DEV/SpoolDir by ct.paywise.co.za (Mercury 1.31); 22 Jun 99 17:12:26 +0200 (MER) Received: from SpoolDir by DEV (Mercury 1.31); 22 Jun 99 17:11:19 +0200 (MER) From: "Andre Pekelaar" Organization: Paywise Software Products (Pty) Ltd To: Jean-Michel DRICOT , questions@freeBSD.org Date: Tue, 22 Jun 1999 17:11:14 +0200 (ZAT) MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Parallel Port File Descriptor problem Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > Date: Mon, 21 Jun 1999 18:50:30 +0200 > From: Jean-Michel DRICOT > > I've put correct permissions (say 777) on /dev/lpt0 and tried using > file descriptor, like in my old LINUX Box :-) with "/dev/lp0" . As > non-root user this time I tried executing: > > int fd=open("/dev/lpt0",O_RDWR); > write(fd,...........); > > But my fd was always <0 (error with IOPerm.) even if executed the > program as root.... > > How can I get a valid FD to a parllel port in order to use > write(fd,.......) ? Since you presumably only want to WRITE to the port, not READ from + WRITE to it, have you tried the following: int fd=open("/dev/lpt0",O_WRONLY); In other words, change O_RDWR to O_WRONLY. I would guess that your problem is that although you appear to have all the relevant permissions, the LPT device driver does not support being opened for reading, hence the "permissions" problem. Hope this helps, Andre ---------------------------------------------------------------------------- Andre Pekelaar Manager, Development Department Paywise Software Products (Pty) Ltd Tel: +27-21-7628720 PO Box 24, Plumstead, 7801 Fax: +27-21-7628726 Cape Town ---------------------------------------------------------------------------- All opinions expressed here are my own and may not reflect the policies or opinions of Paywise Software. ---------------------------------------------------------------------------- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message