From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KWSSL-000459-U7 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 04:57:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KWSSK-00044c-5R for qemu-devel@nongnu.org; Fri, 22 Aug 2008 04:57:16 -0400 Received: from [199.232.76.173] (port=56113 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KWSSJ-00044Y-E9 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 04:57:15 -0400 Received: from savannah.gnu.org ([199.232.41.3]:49152 helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1KWSSJ-0001PS-5r for qemu-devel@nongnu.org; Fri, 22 Aug 2008 04:57:15 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1KWSSF-0004wE-1v for qemu-devel@nongnu.org; Fri, 22 Aug 2008 08:57:11 +0000 Received: from aurel32 by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1KWSSE-0004w1-J3 for qemu-devel@nongnu.org; Fri, 22 Aug 2008 08:57:10 +0000 MIME-Version: 1.0 Errors-To: aurel32 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Aurelien Jarno Message-Id: Date: Fri, 22 Aug 2008 08:57:10 +0000 Subject: [Qemu-devel] [5063] Parallel Port Direction Fix 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 Revision: 5063 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=5063 Author: aurel32 Date: 2008-08-22 08:57:09 +0000 (Fri, 22 Aug 2008) Log Message: ----------- Parallel Port Direction Fix 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. Signed-off-by: Vijay Kumar B Signed-off-by: Aurelien Jarno Modified Paths: -------------- trunk/hw/parallel.c trunk/qemu-char.h trunk/vl.c Modified: trunk/hw/parallel.c =================================================================== --- trunk/hw/parallel.c 2008-08-21 23:03:15 UTC (rev 5062) +++ trunk/hw/parallel.c 2008-08-22 08:57:09 UTC (rev 5063) @@ -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; Modified: trunk/qemu-char.h =================================================================== --- trunk/qemu-char.h 2008-08-21 23:03:15 UTC (rev 5062) +++ trunk/qemu-char.h 2008-08-22 08:57:09 UTC (rev 5063) @@ -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 #define CHR_IOCTL_SERIAL_SET_TIOCM 12 #define CHR_IOCTL_SERIAL_GET_TIOCM 13 Modified: trunk/vl.c =================================================================== --- trunk/vl.c 2008-08-21 23:03:15 UTC (rev 5062) +++ trunk/vl.c 2008-08-22 08:57:09 UTC (rev 5063) @@ -2835,6 +2835,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;