* [Qemu-devel] [PATCH] fix use of host serial port
@ 2009-02-07 17:34 David S. Ahern
2009-02-08 14:45 ` Aurelien Jarno
0 siblings, 1 reply; 2+ messages in thread
From: David S. Ahern @ 2009-02-07 17:34 UTC (permalink / raw)
To: qemu-devel; +Cc: Michael Tokarev
I need to drive this to ground. Can I get this applied?
Thanks,
davd
The following patch fixes use of a host serial port.
My original post on the problem is:
http://marc.info/?l=kvm&m=122995568009533&w=2
Michael Tokarev (mjt@tls.msk.ru) dug into the where the code was
failing: http://marc.info/?l=kvm&m=123300124703645&w=2
and further suggested a solution on which this patch is based.
The changed has been acked by Stefano Stabellini.
Signed-off-by: David Ahern <daahern@cisco.com>
Index: trunk/qemu-char.c
===================================================================
--- trunk/qemu-char.c (revision 6545)
+++ trunk/qemu-char.c (working copy)
@@ -1047,17 +1047,17 @@
int *targ = (int *)arg;
ioctl(s->fd_in, TIOCMGET, &sarg);
*targ = 0;
- if (sarg | TIOCM_CTS)
+ if (sarg & TIOCM_CTS)
*targ |= CHR_TIOCM_CTS;
- if (sarg | TIOCM_CAR)
+ if (sarg & TIOCM_CAR)
*targ |= CHR_TIOCM_CAR;
- if (sarg | TIOCM_DSR)
+ if (sarg & TIOCM_DSR)
*targ |= CHR_TIOCM_DSR;
- if (sarg | TIOCM_RI)
+ if (sarg & TIOCM_RI)
*targ |= CHR_TIOCM_RI;
- if (sarg | TIOCM_DTR)
+ if (sarg & TIOCM_DTR)
*targ |= CHR_TIOCM_DTR;
- if (sarg | TIOCM_RTS)
+ if (sarg & TIOCM_RTS)
*targ |= CHR_TIOCM_RTS;
}
break;
@@ -1065,9 +1065,20 @@
{
int sarg = *(int *)arg;
int targ = 0;
- if (sarg | CHR_TIOCM_DTR)
+ ioctl(s->fd_in, TIOCMGET, &targ);
+ targ &= ~(CHR_TIOCM_CTS | CHR_TIOCM_CAR | CHR_TIOCM_DSR
+ | CHR_TIOCM_RI | CHR_TIOCM_DTR | CHR_TIOCM_RTS);
+ if (sarg & CHR_TIOCM_CTS)
+ targ |= TIOCM_CTS;
+ if (sarg & CHR_TIOCM_CAR)
+ targ |= TIOCM_CAR;
+ if (sarg & CHR_TIOCM_DSR)
+ targ |= TIOCM_DSR;
+ if (sarg & CHR_TIOCM_RI)
+ targ |= TIOCM_RI;
+ if (sarg & CHR_TIOCM_DTR)
targ |= TIOCM_DTR;
- if (sarg | CHR_TIOCM_RTS)
+ if (sarg & CHR_TIOCM_RTS)
targ |= TIOCM_RTS;
ioctl(s->fd_in, TIOCMSET, &targ);
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] fix use of host serial port
2009-02-07 17:34 [Qemu-devel] [PATCH] fix use of host serial port David S. Ahern
@ 2009-02-08 14:45 ` Aurelien Jarno
0 siblings, 0 replies; 2+ messages in thread
From: Aurelien Jarno @ 2009-02-08 14:45 UTC (permalink / raw)
To: David Ahern; +Cc: qemu-devel
On Sat, Feb 07, 2009 at 10:34:55AM -0700, David S. Ahern wrote:
> I need to drive this to ground. Can I get this applied?
>
> Thanks,
> davd
>
>
> The following patch fixes use of a host serial port.
>
> My original post on the problem is:
> http://marc.info/?l=kvm&m=122995568009533&w=2
>
> Michael Tokarev (mjt@tls.msk.ru) dug into the where the code was
> failing: http://marc.info/?l=kvm&m=123300124703645&w=2
>
> and further suggested a solution on which this patch is based.
>
> The changed has been acked by Stefano Stabellini.
>
> Signed-off-by: David Ahern <daahern@cisco.com>
Thanks, applied.
> Index: trunk/qemu-char.c
> ===================================================================
> --- trunk/qemu-char.c (revision 6545)
> +++ trunk/qemu-char.c (working copy)
> @@ -1047,17 +1047,17 @@
> int *targ = (int *)arg;
> ioctl(s->fd_in, TIOCMGET, &sarg);
> *targ = 0;
> - if (sarg | TIOCM_CTS)
> + if (sarg & TIOCM_CTS)
> *targ |= CHR_TIOCM_CTS;
> - if (sarg | TIOCM_CAR)
> + if (sarg & TIOCM_CAR)
> *targ |= CHR_TIOCM_CAR;
> - if (sarg | TIOCM_DSR)
> + if (sarg & TIOCM_DSR)
> *targ |= CHR_TIOCM_DSR;
> - if (sarg | TIOCM_RI)
> + if (sarg & TIOCM_RI)
> *targ |= CHR_TIOCM_RI;
> - if (sarg | TIOCM_DTR)
> + if (sarg & TIOCM_DTR)
> *targ |= CHR_TIOCM_DTR;
> - if (sarg | TIOCM_RTS)
> + if (sarg & TIOCM_RTS)
> *targ |= CHR_TIOCM_RTS;
> }
> break;
> @@ -1065,9 +1065,20 @@
> {
> int sarg = *(int *)arg;
> int targ = 0;
> - if (sarg | CHR_TIOCM_DTR)
> + ioctl(s->fd_in, TIOCMGET, &targ);
> + targ &= ~(CHR_TIOCM_CTS | CHR_TIOCM_CAR | CHR_TIOCM_DSR
> + | CHR_TIOCM_RI | CHR_TIOCM_DTR | CHR_TIOCM_RTS);
> + if (sarg & CHR_TIOCM_CTS)
> + targ |= TIOCM_CTS;
> + if (sarg & CHR_TIOCM_CAR)
> + targ |= TIOCM_CAR;
> + if (sarg & CHR_TIOCM_DSR)
> + targ |= TIOCM_DSR;
> + if (sarg & CHR_TIOCM_RI)
> + targ |= TIOCM_RI;
> + if (sarg & CHR_TIOCM_DTR)
> targ |= TIOCM_DTR;
> - if (sarg | CHR_TIOCM_RTS)
> + if (sarg & CHR_TIOCM_RTS)
> targ |= TIOCM_RTS;
> ioctl(s->fd_in, TIOCMSET, &targ);
> }
>
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-02-08 14:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-07 17:34 [Qemu-devel] [PATCH] fix use of host serial port David S. Ahern
2009-02-08 14:45 ` 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).