From owner-freebsd-hackers Tue Oct 29 8:17:29 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 810D337B401 for ; Tue, 29 Oct 2002 08:17:27 -0800 (PST) Received: from littleboy.csh.rit.edu (littleboy.csh.rit.edu [129.21.60.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5A5DF43E3B for ; Tue, 29 Oct 2002 08:17:23 -0800 (PST) (envelope-from sunday@csh.rit.edu) Received: from fury.csh.rit.edu (fury.csh.rit.edu [129.21.60.5]) by littleboy.csh.rit.edu (Postfix) with ESMTP id ED3B28674; Tue, 29 Oct 2002 11:17:16 -0500 (EST) Received: by fury.csh.rit.edu (Postfix, from userid 38501) id 513592E384; Tue, 29 Oct 2002 11:17:16 -0500 (EST) Date: Tue, 29 Oct 2002 11:17:16 -0500 From: Joe Sunday To: ticso@cicely.de Cc: David Nicholas Kayal , freebsd-hackers@FreeBSD.ORG Subject: Re: i am looking for a 5 volt signal Message-ID: <20021029161715.GB11104@csh.rit.edu> References: <20021028135635.GA28293@csh.rit.edu> <20021029160844.GA16922@cicely8.cicely.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20021029160844.GA16922@cicely8.cicely.de> User-Agent: Mutt/1.4i X-Operating-System: SunOS 5.8 (sun4u) 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 Tue, Oct 29, 2002 at 05:08:45PM +0100, Bernd Walter wrote: > On Mon, Oct 28, 2002 at 08:56:35AM -0500, Joe Sunday wrote: > > On Sun, Oct 27, 2002 at 09:12:33AM -0800, David Nicholas Kayal wrote: > > > > > I'm looking for a 5 volt signal. > > > > > > I have wires plugged into pins 2 and 25 of the parallel port. > > > > > > I have written a small program: > > > > > > #include > > > #include > > > #include > > > > > > int main() > > > { > > > int fd; > > > while(1) > > > { > > > ioctl(fd, PPISDATA, 255); > > > } > > > } > > > > PPISDATA actually takes an int* argument. (The man page may be a tad > > confusing here.) > > No it takes an u_int8_t* exactly as written in the manpage. > Using an int doesn't work in all cases. > I have no idea what part of the manpage is confusing. > > > Try > > int main() { > > int fd; > > int d = 255; > u_int8_t d = 255; > > > fd = open( "/dev/ppi0", O_RDWR ); > > > > ioctl( fd, PPISDATA, &d ); > > > > return 0; > > } My bad. Yeah, it takes a u_int8_t* argument, not an int* (Serves me right for doing it off the top of my head instead of looking at my code). However, the original poster had it simply taking some integer value rather than a pointer. The man page says this: Each command takes a single u_int8_t argument, transferring one byte of data. Which, to me at first glance, can read as a u_int8_t argument, rather than a u_int8_t* argument if you're new to using ioctls. The example further down the man page has it properly taking an pointer. --Joe -- Joe Sunday http://www.csh.rit.edu/~sunday/ Computer Science House, Rochester Inst. Of Technology To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message