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 09/12] usb-desc: USBEndpoint support
Date: Fri,  6 Jan 2012 14:59:03 +0100	[thread overview]
Message-ID: <1325858346-1071-10-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1325858346-1071-1-git-send-email-kraxel@redhat.com>

Initialize USBEndpoint structs from USBDesc* data.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb-desc.c |   22 ++++++++++++++++++++++
 1 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/hw/usb-desc.c b/hw/usb-desc.c
index 9c38661..0768334 100644
--- a/hw/usb-desc.c
+++ b/hw/usb-desc.c
@@ -231,6 +231,27 @@ int usb_desc_other(const USBDescOther *desc, uint8_t *dest, size_t len)
 
 /* ------------------------------------------------------------------ */
 
+static void usb_desc_ep_init(USBDevice *dev)
+{
+    const USBDescIface *iface;
+    int i, e, pid, ep;
+
+    usb_ep_init(dev);
+    for (i = 0; i < dev->ninterfaces; i++) {
+        iface = dev->ifaces[i];
+        if (iface == NULL) {
+            continue;
+        }
+        for (e = 0; e < iface->bNumEndpoints; e++) {
+            pid = (iface->eps[e].bEndpointAddress & USB_DIR_IN) ?
+                USB_TOKEN_IN : USB_TOKEN_OUT;
+            ep = iface->eps[e].bEndpointAddress & 0x0f;
+            usb_ep_set_type(dev, pid, ep, iface->eps[e].bmAttributes & 0x03);
+            usb_ep_set_ifnum(dev, pid, ep, iface->bInterfaceNumber);
+        }
+    }
+}
+
 static const USBDescIface *usb_desc_find_interface(USBDevice *dev,
                                                    int nif, int alt)
 {
@@ -272,6 +293,7 @@ static int usb_desc_set_interface(USBDevice *dev, int index, int value)
     old = dev->altsetting[index];
     dev->altsetting[index] = value;
     dev->ifaces[index] = iface;
+    usb_desc_ep_init(dev);
 
     if (dev->info->set_interface && old != value) {
         dev->info->set_interface(dev, index, old, value);
-- 
1.7.1

  parent reply	other threads:[~2012-01-06 13:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06 13:58 [Qemu-devel] [PATCH 00/12] usb patch queue: audio, xhci Gerd Hoffmann
2012-01-06 13:58 ` [Qemu-devel] [PATCH 01/12] usb-host: rip out legacy procfs support Gerd Hoffmann
2012-01-06 13:58 ` [Qemu-devel] [PATCH 02/12] usb: track configuration and interface count in USBDevice Gerd Hoffmann
2012-01-06 13:58 ` [Qemu-devel] [PATCH 03/12] usb: track altsetting " Gerd Hoffmann
2012-01-06 13:58 ` [Qemu-devel] [PATCH 04/12] usb-desc: audio endpoint support Gerd Hoffmann
2012-01-06 13:58 ` [Qemu-devel] [PATCH 05/12] usb: add audio device model Gerd Hoffmann
2012-01-06 17:23   ` Alex Bradbury
2012-01-06 13:59 ` [Qemu-devel] [PATCH 06/12] xhci: Initial xHCI implementation Gerd Hoffmann
2012-01-06 14:54   ` Stefan Weil
2012-01-09  9:30     ` Gerd Hoffmann
2012-01-06 13:59 ` [Qemu-devel] [PATCH 07/12] usb: add USBEndpoint Gerd Hoffmann
2012-01-06 13:59 ` [Qemu-devel] [PATCH 08/12] usb: add ifnum to USBEndpoint Gerd Hoffmann
2012-01-06 13:59 ` Gerd Hoffmann [this message]
2012-01-06 13:59 ` [Qemu-devel] [PATCH 10/12] usb/debug: add usb_ep_dump Gerd Hoffmann
2012-01-06 13:59 ` [Qemu-devel] [PATCH 11/12] usb: add max_packet_size to USBEndpoint Gerd Hoffmann
2012-01-06 13:59 ` [Qemu-devel] [PATCH 12/12] usb: link packets to endpoints not devices 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=1325858346-1071-10-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).