aboutsummaryrefslogtreecommitdiff
path: root/ui
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-04-03 12:24:25 +0100
committerPeter Maydell <peter.maydell@linaro.org>2017-04-03 12:24:25 +0100
commitf9e46d37bd19b4f3faaedb78a48c53d02ee4197e (patch)
tree6a8d15622367a39b37be6fa0d21a9f26fb4af5b2 /ui
parent9eb5adae26b828219e82f17c854cdf1f192f9565 (diff)
parentfa03cb7fd212bc07f0253db9ea436383ddc6c08f (diff)
downloadqemu-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')
-rw-r--r--ui/input-linux.c17
-rw-r--r--ui/vnc.c8
2 files changed, 16 insertions, 9 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);
}
}
}
diff --git a/ui/vnc.c b/ui/vnc.c
index 821acdd..243e99b 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3786,10 +3786,6 @@ void vnc_display_open(const char *id, Error **errp)
goto fail;
}
- if (saddr == NULL) {
- return;
- }
-
password = qemu_opt_get_bool(opts, "password", false);
if (password) {
if (fips_get_state()) {
@@ -3974,6 +3970,10 @@ void vnc_display_open(const char *id, Error **errp)
register_displaychangelistener(&vd->dcl);
}
+ if (saddr == NULL) {
+ goto cleanup;
+ }
+
if (reverse) {
if (vnc_display_connect(vd, saddr, nsaddr, wsaddr, nwsaddr, errp) < 0) {
goto fail;