From owner-freebsd-hackers@FreeBSD.ORG Tue Mar 15 03:05:34 2005 Return-Path: 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 CE0A016A4D0 for ; Tue, 15 Mar 2005 03:05:34 +0000 (GMT) Received: from wproxy.gmail.com (wproxy.gmail.com [64.233.184.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 74D3443D53 for ; Tue, 15 Mar 2005 03:05:34 +0000 (GMT) (envelope-from uber.caulker@gmail.com) Received: by wproxy.gmail.com with SMTP id 36so973917wri for ; Mon, 14 Mar 2005 19:05:34 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:mime-version:content-type:content-transfer-encoding; b=tu5gG2NhCofXhi+q6HFQKKPMH+tglnI9SzMyohUTGpfwKVMYo413WVd/Yyg9GfdGJxCKstaQUeWRy7nRmyrYQJMNgeXz5eCu8HAnYf0h85oImTYZwrzvh7IGcCVt9kYKyyJj9oz6E67QKlHVW8kBiqIMIfk5QBN6qIE+ojvTpEM= Received: by 10.54.17.71 with SMTP id 71mr1043711wrq; Mon, 14 Mar 2005 19:05:34 -0800 (PST) Received: by 10.54.19.10 with HTTP; Mon, 14 Mar 2005 19:05:34 -0800 (PST) Message-ID: <5e52cc0005031419056fdf10c6@mail.gmail.com> Date: Mon, 14 Mar 2005 22:05:34 -0500 From: Matt Kory To: freebsd-hackers@freebsd.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: poll or select for ppi? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Matt Kory List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Mar 2005 03:05:35 -0000 Is it possible to use poll or select to detect a change in the status bits of the parallel port? I tried something like this, and took bits 5 and 6 of the status register low and nothing seemed to happen. Is what I am trying to do even possible, or I am supposed to take a certain bit low to cause a read event? Any help is appreciated. int ppi_fd; char port[] = "/dev/ppi0"; ppi_fd = open(port, O_RDWR); fd_set rfds; struct timeval tv; tv.tv_sec = 0; tv.tv_usec = 100000; while(1) { FD_ZERO( &rfds ); FD_SET( ppi_fd, &rfds ); if ( select(1, &rfds, NULL, NULL, &tv) ) { printf("hi\n"); } }