qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 5/6] usb: add input routing support for tablet and keyboard
Date: Tue, 20 May 2014 16:00:46 +0200	[thread overview]
Message-ID: <1400594447-16637-6-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1400594447-16637-1-git-send-email-kraxel@redhat.com>

Add display property to the keyboard.
Add display and head properties to the tablet.

If properties are set bind device to the display specified to
setup input routing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/dev-hid.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/usb/dev-hid.c b/hw/usb/dev-hid.c
index d097d93..67a57f1 100644
--- a/hw/usb/dev-hid.c
+++ b/hw/usb/dev-hid.c
@@ -47,6 +47,8 @@ typedef struct USBHIDState {
     USBEndpoint *intr;
     HIDState hid;
     uint32_t usb_version;
+    char *display;
+    uint32_t head;
 } USBHIDState;
 
 enum {
@@ -574,6 +576,9 @@ static int usb_hid_initfn(USBDevice *dev, int kind)
     usb_desc_init(dev);
     us->intr = usb_ep_get(dev, USB_TOKEN_IN, 1);
     hid_init(&us->hid, kind, usb_hid_changed);
+    if (us->display && us->hid.s) {
+        qemu_input_handler_bind(us->hid.s, us->display, us->head, NULL);
+    }
     return 0;
 }
 
@@ -653,6 +658,8 @@ static void usb_hid_class_initfn(ObjectClass *klass, void *data)
 
 static Property usb_tablet_properties[] = {
         DEFINE_PROP_UINT32("usb_version", USBHIDState, usb_version, 2),
+        DEFINE_PROP_STRING("display", USBHIDState, display),
+        DEFINE_PROP_UINT32("head", USBHIDState, head, 0),
         DEFINE_PROP_END_OF_LIST(),
 };
 
@@ -696,6 +703,11 @@ static const TypeInfo usb_mouse_info = {
     .class_init    = usb_mouse_class_initfn,
 };
 
+static Property usb_keyboard_properties[] = {
+        DEFINE_PROP_STRING("display", USBHIDState, display),
+        DEFINE_PROP_END_OF_LIST(),
+};
+
 static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
@@ -706,6 +718,7 @@ static void usb_keyboard_class_initfn(ObjectClass *klass, void *data)
     uc->product_desc   = "QEMU USB Keyboard";
     uc->usb_desc       = &desc_keyboard;
     dc->vmsd = &vmstate_usb_kbd;
+    dc->props = usb_keyboard_properties;
     set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
 }
 
-- 
1.8.3.1

  parent reply	other threads:[~2014-05-20 14:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-20 14:00 [Qemu-devel] [PATCH 0/6] add input routing and multiseat support Gerd Hoffmann
2014-05-20 14:00 ` [Qemu-devel] [PATCH 1/6] input: switch hid keyboard to new input layer api Gerd Hoffmann
2014-05-20 14:00 ` [Qemu-devel] [PATCH 2/6] input: switch hid mouse and tablet to the " Gerd Hoffmann
2014-05-20 14:00 ` [Qemu-devel] [PATCH 3/6] input: bind devices and input routing Gerd Hoffmann
2014-05-20 14:00 ` [Qemu-devel] [PATCH 4/6] sdl: pass key event source to input layer Gerd Hoffmann
2014-05-20 14:00 ` Gerd Hoffmann [this message]
2014-05-20 14:00 ` [Qemu-devel] [PATCH 6/6] docs: add multiseat.txt Gerd Hoffmann
2014-05-20 18:08   ` Paolo Bonzini
2014-05-21  8:38     ` Gerd Hoffmann
2014-05-21  9:18       ` Paolo Bonzini
2014-05-21  9:51         ` Gerd Hoffmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400594447-16637-6-git-send-email-kraxel@redhat.com \
    --to=kraxel@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).