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 2/7] usb-hid: use qdev for -usbdevice
Date: Mon, 26 Oct 2009 15:56:46 +0100	[thread overview]
Message-ID: <1256569011-20256-3-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1256569011-20256-1-git-send-email-kraxel@redhat.com>


Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-hid.c   |    3 +++
 hw/usb-wacom.c |    1 +
 vl.c           |   29 -----------------------------
 3 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index d1cc45e..f4a2a48 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -882,6 +882,7 @@ static struct USBDeviceInfo hid_info[] = {
     {
         .qdev.name      = "QEMU USB Tablet",
         .qdev.alias     = "usb-tablet",
+        .usbdevice_name = "tablet",
         .qdev.size      = sizeof(USBHIDState),
         .init           = usb_tablet_initfn,
         .handle_packet  = usb_generic_handle_packet,
@@ -892,6 +893,7 @@ static struct USBDeviceInfo hid_info[] = {
     },{
         .qdev.name      = "QEMU USB Mouse",
         .qdev.alias     = "usb-mouse",
+        .usbdevice_name = "mouse",
         .qdev.size      = sizeof(USBHIDState),
         .init           = usb_mouse_initfn,
         .handle_packet  = usb_generic_handle_packet,
@@ -902,6 +904,7 @@ static struct USBDeviceInfo hid_info[] = {
     },{
         .qdev.name      = "QEMU USB Keyboard",
         .qdev.alias     = "usb-kbd",
+        .usbdevice_name = "keyboard",
         .qdev.size      = sizeof(USBHIDState),
         .init           = usb_keyboard_initfn,
         .handle_packet  = usb_generic_handle_packet,
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index fa97db2..ef61376 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -411,6 +411,7 @@ static int usb_wacom_initfn(USBDevice *dev)
 static struct USBDeviceInfo wacom_info = {
     .qdev.name      = "QEMU PenPartner Tablet",
     .qdev.alias     = "wacom-tablet",
+    .usbdevice_name = "wacom-tablet",
     .qdev.size      = sizeof(USBWacomState),
     .init           = usb_wacom_initfn,
     .handle_packet  = usb_generic_handle_packet,
diff --git a/vl.c b/vl.c
index 30b5306..52ab14f 100644
--- a/vl.c
+++ b/vl.c
@@ -2533,31 +2533,10 @@ static void usb_msd_password_cb(void *opaque, int err)
         dev->info->handle_destroy(dev);
 }
 
-static struct {
-    const char *name;
-    const char *qdev;
-} usbdevs[] = {
-    {
-        .name = "mouse",
-        .qdev = "QEMU USB Mouse",
-    },{
-        .name = "tablet",
-        .qdev = "QEMU USB Tablet",
-    },{
-        .name = "keyboard",
-        .qdev = "QEMU USB Keyboard",
-    },{
-        .name = "wacom-tablet",
-        .qdev = "QEMU PenPartner Tablet",
-    }
-};
-
 static int usb_device_add(const char *devname, int is_hotplug)
 {
     const char *p;
-    USBBus *bus = usb_bus_find(-1 /* any */);
     USBDevice *dev = NULL;
-    int i;
 
     if (!usb_enabled)
         return -1;
@@ -2567,14 +2546,6 @@ static int usb_device_add(const char *devname, int is_hotplug)
     if (dev)
         goto done;
 
-    /* simple devices which don't need extra care */
-    for (i = 0; i < ARRAY_SIZE(usbdevs); i++) {
-        if (strcmp(devname, usbdevs[i].name) != 0)
-            continue;
-        dev = usb_create_simple(bus, usbdevs[i].qdev);
-        goto done;
-    }
-
     /* the other ones */
     if (strstart(devname, "host:", &p)) {
         dev = usb_host_device_open(p);
-- 
1.6.2.5

  parent reply	other threads:[~2009-10-26 14:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-26 14:56 [Qemu-devel] [PATCH v2 0/7] use qdev for -usbdevice Gerd Hoffmann
2009-10-26 14:56 ` [Qemu-devel] [PATCH 1/7] usb core: " Gerd Hoffmann
2009-10-26 14:56 ` Gerd Hoffmann [this message]
2009-10-26 14:56 ` [Qemu-devel] [PATCH 3/7] usb-serial and braille: " Gerd Hoffmann
2009-10-26 14:56 ` [Qemu-devel] [PATCH 4/7] usb: make attach optional Gerd Hoffmann
2009-10-26 14:56 ` [Qemu-devel] [PATCH 5/7] usb-storage: use qdev for -usbdevice Gerd Hoffmann
2009-10-26 14:56 ` [Qemu-devel] [PATCH 6/7] usb-host: use qdev for -usbdevice + rework Gerd Hoffmann
2009-10-26 14:56 ` [Qemu-devel] [PATCH 7/7] usb: print attached status in info qtree 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=1256569011-20256-3-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).