* [Qemu-devel] [5063] Parallel Port Direction Fix
@ 2008-08-22 8:57 Aurelien Jarno
2008-08-22 9:34 ` Vijay Kumar
0 siblings, 1 reply; 4+ messages in thread
From: Aurelien Jarno @ 2008-08-22 8:57 UTC (permalink / raw)
To: qemu-devel
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 <vijaykumar@bravegnu.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
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;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [5063] Parallel Port Direction Fix
2008-08-22 8:57 [Qemu-devel] [5063] Parallel Port Direction Fix Aurelien Jarno
@ 2008-08-22 9:34 ` Vijay Kumar
2008-08-22 10:44 ` Samuel Thibault
2008-08-22 21:25 ` Aurelien Jarno
0 siblings, 2 replies; 4+ messages in thread
From: Vijay Kumar @ 2008-08-22 9:34 UTC (permalink / raw)
To: qemu-devel
Aurelien Jarno wrote:
> 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
Jarno, thanks for committing the patch. But it seems that now there are two IOCTL macros with the same value. To be safe we can move CHR_IOCTL_PP_DATA_DIR to 14.
Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
Index: qemu/qemu-char.h
===================================================================
--- qemu.orig/qemu-char.h 2008-08-22 15:02:12.000000000 +0530
+++ qemu/qemu-char.h 2008-08-22 15:02:16.000000000 +0530
@@ -27,11 +27,12 @@
#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
+#define CHR_IOCTL_PP_DATA_DIR 14
+
#define CHR_TIOCM_CTS 0x020
#define CHR_TIOCM_CAR 0x040
#define CHR_TIOCM_DSR 0x100
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [5063] Parallel Port Direction Fix
2008-08-22 9:34 ` Vijay Kumar
@ 2008-08-22 10:44 ` Samuel Thibault
2008-08-22 21:25 ` Aurelien Jarno
1 sibling, 0 replies; 4+ messages in thread
From: Samuel Thibault @ 2008-08-22 10:44 UTC (permalink / raw)
To: qemu-devel
Vijay Kumar, le Fri 22 Aug 2008 15:04:22 +0530, a écrit :
> Aurelien Jarno wrote:
> >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
>
> Jarno, thanks for committing the patch. But it seems that now there are two
> IOCTL macros with the same value. To be safe we can move
> CHR_IOCTL_PP_DATA_DIR to 14.
Or we can push the serial ioctls. All the code using it gets recompiled
anyway.
Samuel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [5063] Parallel Port Direction Fix
2008-08-22 9:34 ` Vijay Kumar
2008-08-22 10:44 ` Samuel Thibault
@ 2008-08-22 21:25 ` Aurelien Jarno
1 sibling, 0 replies; 4+ messages in thread
From: Aurelien Jarno @ 2008-08-22 21:25 UTC (permalink / raw)
To: qemu-devel
On Fri, Aug 22, 2008 at 03:04:22PM +0530, Vijay Kumar wrote:
> Aurelien Jarno wrote:
>> 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
>
> Jarno, thanks for committing the patch. But it seems that now there are two IOCTL macros with the same value. To be safe we can move CHR_IOCTL_PP_DATA_DIR to 14.
Oh right, thanks. I have just applied what samuel suggested.
> Signed-off-by: Vijay Kumar <vijaykumar@bravegnu.org>
>
> Index: qemu/qemu-char.h
> ===================================================================
> --- qemu.orig/qemu-char.h 2008-08-22 15:02:12.000000000 +0530
> +++ qemu/qemu-char.h 2008-08-22 15:02:16.000000000 +0530
> @@ -27,11 +27,12 @@
> #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
>
> +#define CHR_IOCTL_PP_DATA_DIR 14
> +
> #define CHR_TIOCM_CTS 0x020
> #define CHR_TIOCM_CAR 0x040
> #define CHR_TIOCM_DSR 0x100
>
>
>
>
--
.''`. Aurelien Jarno | GPG: 1024D/F1BCDB73
: :' : Debian developer | Electrical Engineer
`. `' aurel32@debian.org | aurelien@aurel32.net
`- people.debian.org/~aurel32 | www.aurel32.net
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-08-22 21:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-22 8:57 [Qemu-devel] [5063] Parallel Port Direction Fix Aurelien Jarno
2008-08-22 9:34 ` Vijay Kumar
2008-08-22 10:44 ` Samuel Thibault
2008-08-22 21:25 ` Aurelien Jarno
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).