diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-04-03 12:24:25 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-04-03 12:24:25 +0100 |
commit | f9e46d37bd19b4f3faaedb78a48c53d02ee4197e (patch) | |
tree | 6a8d15622367a39b37be6fa0d21a9f26fb4af5b2 /ui/input-linux.c | |
parent | 9eb5adae26b828219e82f17c854cdf1f192f9565 (diff) | |
parent | fa03cb7fd212bc07f0253db9ea436383ddc6c08f (diff) | |
download | qemu-f9e46d37bd19b4f3faaedb78a48c53d02ee4197e.zip qemu-f9e46d37bd19b4f3faaedb78a48c53d02ee4197e.tar.gz qemu-f9e46d37bd19b4f3faaedb78a48c53d02ee4197e.tar.bz2 |
Merge remote-tracking branch 'remotes/kraxel/tags/pull-fixes-20170403-1' into staging
bugfixes: xhci, input-linux and vnc
# gpg: Signature made Mon 03 Apr 2017 11:25:29 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/pull-fixes-20170403-1:
vnc: allow to connect with add_client when -vnc none
Fix input-linux reading from device
xhci: flush dequeue pointer to endpoint context
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'ui/input-linux.c')
-rw-r--r-- | ui/input-linux.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ui/input-linux.c b/ui/input-linux.c index ac31f47..dc0613c 100644 --- a/ui/input-linux.c +++ b/ui/input-linux.c @@ -169,6 +169,8 @@ struct InputLinux { bool has_abs_x; int num_keys; int num_btns; + struct input_event event; + int read_offset; QTAILQ_ENTRY(InputLinux) next; }; @@ -327,25 +329,30 @@ static void input_linux_handle_mouse(InputLinux *il, struct input_event *event) static void input_linux_event(void *opaque) { InputLinux *il = opaque; - struct input_event event; int rc; + int read_size; + uint8_t *p = (uint8_t *)&il->event; for (;;) { - rc = read(il->fd, &event, sizeof(event)); - if (rc != sizeof(event)) { + read_size = sizeof(il->event) - il->read_offset; + rc = read(il->fd, &p[il->read_offset], read_size); + if (rc != read_size) { if (rc < 0 && errno != EAGAIN) { fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno)); qemu_set_fd_handler(il->fd, NULL, NULL, NULL); close(il->fd); + } else if (rc > 0) { + il->read_offset += rc; } break; } + il->read_offset = 0; if (il->num_keys) { - input_linux_handle_keyboard(il, &event); + input_linux_handle_keyboard(il, &il->event); } if (il->has_rel_x && il->num_btns) { - input_linux_handle_mouse(il, &event); + input_linux_handle_mouse(il, &il->event); } } } |