From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Hans de Goede <hdegoede@redhat.com>, Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 4/6] usb: Allow overriding of usb_desc at the device level
Date: Wed, 5 Dec 2012 11:11:22 +0100 [thread overview]
Message-ID: <1354702284-13518-5-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1354702284-13518-1-git-send-email-kraxel@redhat.com>
From: Hans de Goede <hdegoede@redhat.com>
This allows devices to present a different set of descriptors based on
device properties.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb.h | 1 +
hw/usb/bus.c | 3 +++
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/hw/usb.h b/hw/usb.h
index 58f812f..268e653 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -230,6 +230,7 @@ struct USBDevice {
USBEndpoint ep_out[USB_MAX_ENDPOINTS];
QLIST_HEAD(, USBDescString) strings;
+ const USBDesc *usb_desc; /* Overrides class usb_desc if not NULL */
const USBDescDevice *device;
int configuration;
diff --git a/hw/usb/bus.c b/hw/usb/bus.c
index 55d0edd..8264c24 100644
--- a/hw/usb/bus.c
+++ b/hw/usb/bus.c
@@ -166,6 +166,9 @@ const char *usb_device_get_product_desc(USBDevice *dev)
const USBDesc *usb_device_get_usb_desc(USBDevice *dev)
{
USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
+ if (dev->usb_desc) {
+ return dev->usb_desc;
+ }
return klass->usb_desc;
}
--
1.7.1
next prev parent reply other threads:[~2012-12-05 10:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-05 10:11 [Qemu-devel] [PULL 0/6] usb patch queue Gerd Hoffmann
2012-12-05 10:11 ` [Qemu-devel] [PATCH 1/6] add pc-1.4 Gerd Hoffmann
2012-12-05 10:11 ` [Qemu-devel] [PATCH 2/6] usb: Call wakeup when data becomes available for all devices with int eps Gerd Hoffmann
2012-12-05 10:11 ` [Qemu-devel] [PATCH 3/6] usb: Don't allow USB_RET_ASYNC for interrupt packets Gerd Hoffmann
2012-12-05 10:11 ` Gerd Hoffmann [this message]
2012-12-05 10:11 ` [Qemu-devel] [PATCH 5/6] ehci: Lower timer freq when the periodic schedule is idle Gerd Hoffmann
2012-12-05 10:11 ` [Qemu-devel] [PATCH 6/6] usb-tablet: Allow connecting to ehci Gerd Hoffmann
2012-12-26 12:07 ` Erik Rull
2012-12-26 15:53 ` Hao Luo
2012-12-30 9:29 ` Hans de Goede
2012-12-30 11:55 ` Erik Rull
2013-01-02 15:57 ` Hans de Goede
2012-12-10 16:59 ` [Qemu-devel] [PULL 0/6] usb patch queue Anthony Liguori
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=1354702284-13518-5-git-send-email-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=hdegoede@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).