diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-06-23 12:00:21 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-06-23 12:00:21 +0100 |
commit | 40b06f523070deb55f87f9bcee4fedb6c69942f9 (patch) | |
tree | 11040c4594ad630ab23221570c5aad5aa01887b3 /hw | |
parent | 4c8c1cc544dbd5e2564868e61c5037258e393832 (diff) | |
parent | 6e24ee0c1e4b6c0c9c748acab77ecd113c942a4d (diff) | |
download | qemu-40b06f523070deb55f87f9bcee4fedb6c69942f9.zip qemu-40b06f523070deb55f87f9bcee4fedb6c69942f9.tar.gz qemu-40b06f523070deb55f87f9bcee4fedb6c69942f9.tar.bz2 |
Merge remote-tracking branch 'remotes/kraxel/tags/ui-and-input-20170623-pull-request' into staging
# gpg: Signature made Fri 23 Jun 2017 11:39:22 BST
# gpg: using RSA key 0x4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>"
# gpg: aka "Gerd Hoffmann <gerd@kraxel.org>"
# gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>"
# Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138
* remotes/kraxel/tags/ui-and-input-20170623-pull-request:
ps2: reset queue in ps2_reset_keyboard
ps2: add ps2_reset_queue
ps2: add and use PS2State typedef
sdl2: add assert to make coverity happy
hid: Reset kbd modifiers on reset
input: Decrement queue count on kbd delay
keymaps: add tracing
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/input/hid.c | 1 | ||||
-rw-r--r-- | hw/input/ps2.c | 28 |
2 files changed, 17 insertions, 12 deletions
diff --git a/hw/input/hid.c b/hw/input/hid.c index 93887ec..0d049ff 100644 --- a/hw/input/hid.c +++ b/hw/input/hid.c @@ -487,6 +487,7 @@ void hid_reset(HIDState *hs) memset(hs->kbd.keycodes, 0, sizeof(hs->kbd.keycodes)); memset(hs->kbd.key, 0, sizeof(hs->kbd.key)); hs->kbd.keys = 0; + hs->kbd.modifiers = 0; break; case HID_MOUSE: case HID_TABLET: diff --git a/hw/input/ps2.c b/hw/input/ps2.c index 1d3a440..3ba05ef 100644 --- a/hw/input/ps2.c +++ b/hw/input/ps2.c @@ -85,12 +85,12 @@ typedef struct { int rptr, wptr, count; } PS2Queue; -typedef struct { +struct PS2State { PS2Queue queue; int32_t write_cmd; void (*update_irq)(void *, int); void *update_arg; -} PS2State; +}; typedef struct { PS2State common; @@ -551,9 +551,17 @@ static uint8_t translate_table[256] = { 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, }; -void ps2_queue(void *opaque, int b) +static void ps2_reset_queue(PS2State *s) +{ + PS2Queue *q = &s->queue; + + q->rptr = 0; + q->wptr = 0; + q->count = 0; +} + +void ps2_queue(PS2State *s, int b) { - PS2State *s = (PS2State *)opaque; PS2Queue *q = &s->queue; if (q->count >= PS2_QUEUE_SIZE - 1) @@ -692,13 +700,12 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src, } } -uint32_t ps2_read_data(void *opaque) +uint32_t ps2_read_data(PS2State *s) { - PS2State *s = (PS2State *)opaque; PS2Queue *q; int val, index; - trace_ps2_read_data(opaque); + trace_ps2_read_data(s); q = &s->queue; if (q->count == 0) { /* NOTE: if no data left, we return the last keyboard one @@ -733,6 +740,7 @@ static void ps2_reset_keyboard(PS2KbdState *s) trace_ps2_reset_keyboard(s); s->scan_enabled = 1; s->scancode_set = 2; + ps2_reset_queue(&s->common); ps2_set_ledstate(s, 0); } @@ -1081,12 +1089,8 @@ void ps2_write_mouse(void *opaque, int val) static void ps2_common_reset(PS2State *s) { - PS2Queue *q; s->write_cmd = -1; - q = &s->queue; - q->rptr = 0; - q->wptr = 0; - q->count = 0; + ps2_reset_queue(s); s->update_irq(s->update_arg, 0); } |