From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWSWS-000632-LY for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:01:32 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWSWR-00062k-M3 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:01:32 -0400 Received: from [199.232.76.173] (port=51646 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWSWR-00062h-In for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:01:31 -0400 Received: from hall.aurel32.net ([91.121.138.14]:43920) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWSWR-0002BX-5f for qemu-devel@nongnu.org; Fri, 22 Aug 2008 05:01:31 -0400 Received: from farad.aurel32.net ([82.232.2.251] helo=volta.aurel32.net) by hall.aurel32.net with esmtpsa (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1KWSWP-0005Qd-FI for qemu-devel@nongnu.org; Fri, 22 Aug 2008 11:01:29 +0200 Received: from aurel32 by volta.aurel32.net with local (Exim 4.69) (envelope-from ) id 1KWSWP-0005ha-0e for qemu-devel@nongnu.org; Fri, 22 Aug 2008 11:01:29 +0200 Date: Fri, 22 Aug 2008 11:01:28 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] Parallel Port Direction Fix Message-ID: <20080822090128.GE21526@volta.aurel32.net> References: <484E6A77.3080705@bravegnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <484E6A77.3080705@bravegnu.org> Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Tue, Jun 10, 2008 at 05:20:15PM +0530, Vijay Kumar wrote: > The direction bit in the control register should not be directly > set using PPWCONTROL. The kernel gives the following debug message. > > parport0 (ppdev0): use data_reverse for this! > > More over setting the data pins to forward mode does not work, > perhaps a bug in the Linux PP driver. The right way to do this is > to use PPDATADIR to set the direction. The patch checks if the > user is toggling the direction bit, and invokes PPDATADIR to > do the job. Applied, thanks. > Signed-off-by: Vijay Kumar B > --- > diff -Naur qemu-orig/hw/parallel.c qemu-mod/hw/parallel.c > --- qemu-orig/hw/parallel.c 2008-06-10 16:58:10.000000000 +0530 > +++ qemu-mod/hw/parallel.c 2008-06-10 16:47:23.000000000 +0530 > @@ -129,6 +129,7 @@ > { > ParallelState *s = opaque; > uint8_t parm = val; > + int dir; > > /* Sometimes programs do several writes for timing purposes on old > HW. Take care not to waste time on writes that do nothing. */ > @@ -154,6 +155,17 @@ > if (s->control == val) > return; > pdebug("wc%02x\n", val); > + > + if ((val & PARA_CTR_DIR) != (s->control & PARA_CTR_DIR)) { > + if (val & PARA_CTR_DIR) { > + dir = 1; > + } else { > + dir = 0; > + } > + qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_DATA_DIR, &dir); > + parm &= ~PARA_CTR_DIR; > + } > + > qemu_chr_ioctl(s->chr, CHR_IOCTL_PP_WRITE_CONTROL, &parm); > s->control = val; > break; > diff -Naur qemu-orig/qemu-char.h qemu-mod/qemu-char.h > --- qemu-orig/qemu-char.h 2008-06-10 16:58:10.000000000 +0530 > +++ qemu-mod/qemu-char.h 2008-06-10 16:39:24.000000000 +0530 > @@ -27,6 +27,7 @@ > #define CHR_IOCTL_PP_EPP_READ 9 > #define CHR_IOCTL_PP_EPP_WRITE_ADDR 10 > #define CHR_IOCTL_PP_EPP_WRITE 11 > +#define CHR_IOCTL_PP_DATA_DIR 12 > > typedef void IOEventHandler(void *opaque, int event); > > diff -Naur qemu-orig/vl.c qemu-mod/vl.c > --- qemu-orig/vl.c 2008-06-10 16:58:10.000000000 +0530 > +++ qemu-mod/vl.c 2008-06-10 16:39:24.000000000 +0530 > @@ -2525,6 +2525,10 @@ > return -ENOTSUP; > *(uint8_t *)arg = b; > break; > + case CHR_IOCTL_PP_DATA_DIR: > + if (ioctl(fd, PPDATADIR, (int *)arg) < 0) > + return -ENOTSUP; > + break; > case CHR_IOCTL_PP_EPP_READ_ADDR: > if (pp_hw_mode(drv, IEEE1284_MODE_EPP|IEEE1284_ADDR)) { > struct ParallelIOArg *parg = arg; > > > -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net