From owner-freebsd-hackers Sun Oct 27 22:10:42 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7847E37B401 for ; Sun, 27 Oct 2002 22:10:41 -0800 (PST) Received: from saturn.bsdhome.com (rdu25-2-113.nc.rr.com [24.25.2.113]) by mx1.FreeBSD.org (Postfix) with ESMTP id C202843E3B for ; Sun, 27 Oct 2002 22:10:40 -0800 (PST) (envelope-from bsd@bsdhome.com) Received: from neutrino.bsdhome.com (jupiter [192.168.220.13]) by saturn.bsdhome.com (8.12.6/8.12.6) with ESMTP id g9S6Adg0013625; Mon, 28 Oct 2002 01:10:39 -0500 (EST) (envelope-from bsd@bsdhome.com) Received: from neutrino.bsdhome.com (localhost [127.0.0.1]) by neutrino.bsdhome.com (8.12.6/8.12.6) with ESMTP id g9S6AYcP072158; Mon, 28 Oct 2002 01:10:34 -0500 (EST) (envelope-from bsd@neutrino.bsdhome.com) Received: (from bsd@localhost) by neutrino.bsdhome.com (8.12.6/8.12.6/Submit) id g9S6AXk0072157; Mon, 28 Oct 2002 01:10:33 -0500 (EST) Date: Mon, 28 Oct 2002 01:10:33 -0500 From: Brian Dean To: David Nicholas Kayal Cc: freebsd-hackers@FreeBSD.org Subject: Re: Programming the Parallel Port using ppi. Message-ID: <20021028061033.GA65546@neutrino.bsdhome.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sun, Oct 27, 2002 at 04:31:46PM -0800, David Nicholas Kayal wrote: > #include > #include > #include > #include > > int main() > { > int fd; > u_int8_t val; > > fd = open("/dev/ppi0", O_RDWR); > val = 0xff; > while(1) > { > ioctl(fd, PPISDATA, &val); > ioctl(fd, PPIGCTRL, &val); > val |= STROBE; > ioctl(fd, PPISCTRL, &val); > val &= ~STROBE; > ioctl(fd, PPISCTRL, &val); > } > } You should really check your return values. The parallel port is not writeable by default, so unless you've changed it, or are running as root, your program is most likely failing to even open it, but you're not noticing because you aren't checking your return codes. -Brian -- Brian Dean bsd@FreeBSD.org bsd@bsdhome.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message