Date: Tue, 22 Jun 1999 17:11:14 +0200 (ZAT) From: "Andre Pekelaar" <andre@ct.paywise.co.za> To: Jean-Michel DRICOT <jdricot@ulb.ac.be>, questions@freeBSD.org Subject: Parallel Port File Descriptor problem Message-ID: <199906221513.RAA03521@ct.paywise.co.za>
next in thread | raw e-mail | index | archive | help
> Date: Mon, 21 Jun 1999 18:50:30 +0200 > From: Jean-Michel DRICOT <jdricot@ulb.ac.be> > > 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 <andre@ct.paywise.co.za> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199906221513.RAA03521>