* [PATCH] hw/char/pl011: fix receiving multiple chars
@ 2021-02-21 15:04 Zack Marvel
2021-02-21 15:19 ` Peter Maydell
0 siblings, 1 reply; 3+ messages in thread
From: Zack Marvel @ 2021-02-21 15:04 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, Peter Maydell, Zack Marvel, qemu-arm
When using the GTK UI with libvte, multicharacter keystrokes are not
sent correctly (such as arrow keys). This is not an issue for e.g. the
SDL UI because qemu_chr_be_write is called with len=1 for each character
(SDL sends more than once keystroke).
Buglink: https://bugs.launchpad.net/qemu/+bug/1407808
Signed-off-by: Zack Marvel <zpmarvel@gmail.com>
---
hw/char/pl011.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/hw/char/pl011.c b/hw/char/pl011.c
index ea4a4e5235..2ea8fd2685 100644
--- a/hw/char/pl011.c
+++ b/hw/char/pl011.c
@@ -300,7 +300,9 @@ static void pl011_put_fifo(void *opaque, uint32_t value)
static void pl011_receive(void *opaque, const uint8_t *buf, int size)
{
- pl011_put_fifo(opaque, *buf);
+ for (int i = 0; i < size; i++) {
+ pl011_put_fifo(opaque, buf[i]);
+ }
}
static void pl011_event(void *opaque, QEMUChrEvent event)
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/char/pl011: fix receiving multiple chars
2021-02-21 15:04 [PATCH] hw/char/pl011: fix receiving multiple chars Zack Marvel
@ 2021-02-21 15:19 ` Peter Maydell
2021-02-21 16:37 ` Zack Marvel
0 siblings, 1 reply; 3+ messages in thread
From: Peter Maydell @ 2021-02-21 15:19 UTC (permalink / raw)
To: Zack Marvel; +Cc: QEMU Trivial, qemu-arm, QEMU Developers
On Sun, 21 Feb 2021 at 15:04, Zack Marvel <zpmarvel@gmail.com> wrote:
>
> When using the GTK UI with libvte, multicharacter keystrokes are not
> sent correctly (such as arrow keys). This is not an issue for e.g. the
> SDL UI because qemu_chr_be_write is called with len=1 for each character
> (SDL sends more than once keystroke).
>
> Buglink: https://bugs.launchpad.net/qemu/+bug/1407808
>
> Signed-off-by: Zack Marvel <zpmarvel@gmail.com>
> @@ -300,7 +300,9 @@ static void pl011_put_fifo(void *opaque, uint32_t value)
>
> static void pl011_receive(void *opaque, const uint8_t *buf, int size)
> {
> - pl011_put_fifo(opaque, *buf);
> + for (int i = 0; i < size; i++) {
> + pl011_put_fifo(opaque, buf[i]);
> + }
> }
I think this is a bug in whatever is on the other end
of the chardev connection. The pl011 can_receive routine
only ever returns 0 or 1, so it is an error for the
code calling its receive function to ever pass a
size that is greater than 1.
thanks
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] hw/char/pl011: fix receiving multiple chars
2021-02-21 15:19 ` Peter Maydell
@ 2021-02-21 16:37 ` Zack Marvel
0 siblings, 0 replies; 3+ messages in thread
From: Zack Marvel @ 2021-02-21 16:37 UTC (permalink / raw)
To: Peter Maydell; +Cc: QEMU Trivial, qemu-arm, QEMU Developers
Peter,
Thanks for the quick review. You're right, I misunderstood the API and
the bug is in ui/gtk.c.
Thanks,
Zack M
On 2/21/21 8:19 AM, Peter Maydell wrote:
> On Sun, 21 Feb 2021 at 15:04, Zack Marvel <zpmarvel@gmail.com> wrote:
>>
>> When using the GTK UI with libvte, multicharacter keystrokes are not
>> sent correctly (such as arrow keys). This is not an issue for e.g. the
>> SDL UI because qemu_chr_be_write is called with len=1 for each character
>> (SDL sends more than once keystroke).
>>
>> Buglink: https://bugs.launchpad.net/qemu/+bug/1407808
>>
>> Signed-off-by: Zack Marvel <zpmarvel@gmail.com>
>
>> @@ -300,7 +300,9 @@ static void pl011_put_fifo(void *opaque, uint32_t value)
>>
>> static void pl011_receive(void *opaque, const uint8_t *buf, int size)
>> {
>> - pl011_put_fifo(opaque, *buf);
>> + for (int i = 0; i < size; i++) {
>> + pl011_put_fifo(opaque, buf[i]);
>> + }
>> }
>
> I think this is a bug in whatever is on the other end
> of the chardev connection. The pl011 can_receive routine
> only ever returns 0 or 1, so it is an error for the
> code calling its receive function to ever pass a
> size that is greater than 1.
>
> thanks
> -- PMM
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-02-21 16:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-21 15:04 [PATCH] hw/char/pl011: fix receiving multiple chars Zack Marvel
2021-02-21 15:19 ` Peter Maydell
2021-02-21 16:37 ` Zack Marvel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.