qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.0 0/3] input bugfixes.
@ 2014-04-01  9:18 Gerd Hoffmann
  2014-04-01  9:18 ` [Qemu-devel] [PULL 1/3] input: fix input_event_key_number trace event Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-04-01  9:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Three little bugfixes for the new input code.

please pull for 2.0,
  Gerd

The following changes since commit 63678e17cf399ff81b93417fe7bee8d6ef6b6b1b:

  configure: add option to disable -fstack-protector flags (2014-03-31 20:16:02 +0100)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/pull-input-7

for you to fetch changes up to bdcc3a28b7f6ed6b90ad8b8af7b5d17e0d3f1f06:

  input: add sanity check (2014-04-01 10:17:45 +0200)

----------------------------------------------------------------
input bugfixes for 2.0

----------------------------------------------------------------
Gerd Hoffmann (2):
      input: fix input_event_key_number trace event
      input: add sanity check

Hani Benhabiles (1):
      input: mouse_set should check input device type.

 trace-events |  2 +-
 ui/input.c   | 19 ++++++++++++++-----
 2 files changed, 15 insertions(+), 6 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 1/3] input: fix input_event_key_number trace event
  2014-04-01  9:18 [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Gerd Hoffmann
@ 2014-04-01  9:18 ` Gerd Hoffmann
  2014-04-01  9:18 ` [Qemu-devel] [PULL 2/3] input: mouse_set should check input device type Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-04-01  9:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 trace-events | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace-events b/trace-events
index 3df3f32..9303245 100644
--- a/trace-events
+++ b/trace-events
@@ -1022,7 +1022,7 @@ gd_update(int x, int y, int w, int h) "x=%d, y=%d, w=%d, h=%d"
 gd_key_event(int gdk_keycode, int qemu_keycode, const char *action) "translated GDK keycode %d to QEMU keycode %d (%s)"
 
 # ui/input.c
-input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%d, down %d"
+input_event_key_number(int conidx, int number, bool down) "con %d, key number 0x%x, down %d"
 input_event_key_qcode(int conidx, const char *qcode, bool down) "con %d, key qcode %s, down %d"
 input_event_btn(int conidx, const char *btn, bool down) "con %d, button %s, down %d"
 input_event_rel(int conidx, const char *axis, int value) "con %d, axis %s, value %d"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 2/3] input: mouse_set should check input device type.
  2014-04-01  9:18 [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Gerd Hoffmann
  2014-04-01  9:18 ` [Qemu-devel] [PULL 1/3] input: fix input_event_key_number trace event Gerd Hoffmann
@ 2014-04-01  9:18 ` Gerd Hoffmann
  2014-04-01  9:18 ` [Qemu-devel] [PULL 3/3] input: add sanity check Gerd Hoffmann
  2014-04-01 17:15 ` [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-04-01  9:18 UTC (permalink / raw)
  To: qemu-devel
  Cc: Hani Benhabiles, Gerd Hoffmann, Hani Benhabiles, Anthony Liguori

From: Hani Benhabiles <kroosec@gmail.com>

Otherwise, the index of an input device like a usb-kbd is silently accepted.

(qemu) info mice
  Mouse #2: QEMU PS/2 Mouse
* Mouse #3: QEMU HID Mouse
(qemu) mouse_set 1
(qemu) info mice
  Mouse #2: QEMU PS/2 Mouse
* Mouse #3: QEMU HID Mouse

Also replace monitor_printf() call in do_mouse_set() with error_report() and
adjust error message.

Signed-off-by: Hani Benhabiles <hani@linux.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/input.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/ui/input.c b/ui/input.c
index 2761911..6e6a924 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -342,15 +342,21 @@ void do_mouse_set(Monitor *mon, const QDict *qdict)
     int found = 0;
 
     QTAILQ_FOREACH(s, &handlers, node) {
-        if (s->id == index) {
-            found = 1;
-            qemu_input_handler_activate(s);
-            break;
+        if (s->id != index) {
+            continue;
         }
+        if (!(s->handler->mask & (INPUT_EVENT_MASK_REL |
+                                  INPUT_EVENT_MASK_ABS))) {
+            error_report("Input device '%s' is not a mouse", s->handler->name);
+            return;
+        }
+        found = 1;
+        qemu_input_handler_activate(s);
+        break;
     }
 
     if (!found) {
-        monitor_printf(mon, "Mouse at given index not found\n");
+        error_report("Mouse at index '%d' not found", index);
     }
 
     qemu_input_check_mode_change();
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 3/3] input: add sanity check
  2014-04-01  9:18 [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Gerd Hoffmann
  2014-04-01  9:18 ` [Qemu-devel] [PULL 1/3] input: fix input_event_key_number trace event Gerd Hoffmann
  2014-04-01  9:18 ` [Qemu-devel] [PULL 2/3] input: mouse_set should check input device type Gerd Hoffmann
@ 2014-04-01  9:18 ` Gerd Hoffmann
  2014-04-01 17:15 ` [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2014-04-01  9:18 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Anthony Liguori

Check we've actually found a input handler before trying to call it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/input.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/input.c b/ui/input.c
index 6e6a924..1ed0e78 100644
--- a/ui/input.c
+++ b/ui/input.c
@@ -143,6 +143,9 @@ void qemu_input_event_send(QemuConsole *src, InputEvent *evt)
 
     /* send event */
     s = qemu_input_find_handler(1 << evt->kind);
+    if (!s) {
+        return;
+    }
     s->handler->event(s->dev, src, evt);
     s->events++;
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PULL for-2.0 0/3] input bugfixes.
  2014-04-01  9:18 [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2014-04-01  9:18 ` [Qemu-devel] [PULL 3/3] input: add sanity check Gerd Hoffmann
@ 2014-04-01 17:15 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2014-04-01 17:15 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 1 April 2014 10:18, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Three little bugfixes for the new input code.
>
> please pull for 2.0,
>   Gerd
>
> The following changes since commit 63678e17cf399ff81b93417fe7bee8d6ef6b6b1b:
>
>   configure: add option to disable -fstack-protector flags (2014-03-31 20:16:02 +0100)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/pull-input-7

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-01 17:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-01  9:18 [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Gerd Hoffmann
2014-04-01  9:18 ` [Qemu-devel] [PULL 1/3] input: fix input_event_key_number trace event Gerd Hoffmann
2014-04-01  9:18 ` [Qemu-devel] [PULL 2/3] input: mouse_set should check input device type Gerd Hoffmann
2014-04-01  9:18 ` [Qemu-devel] [PULL 3/3] input: add sanity check Gerd Hoffmann
2014-04-01 17:15 ` [Qemu-devel] [PULL for-2.0 0/3] input bugfixes Peter Maydell

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).