[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/8] usb-redir: Add an usbredir_setup_usb_eps() help
From: |
Hans de Goede |
Subject: |
[Qemu-devel] [PATCH 5/8] usb-redir: Add an usbredir_setup_usb_eps() helper function |
Date: |
Wed, 31 Oct 2012 13:47:13 +0100 |
Signed-off-by: Hans de Goede <address@hidden>
---
hw/usb/redirect.c | 45 ++++++++++++++++++++++-----------------------
1 file changed, 22 insertions(+), 23 deletions(-)
diff --git a/hw/usb/redirect.c b/hw/usb/redirect.c
index d7a08b2..ade5cc6 100644
--- a/hw/usb/redirect.c
+++ b/hw/usb/redirect.c
@@ -1336,17 +1336,35 @@ static void usbredir_set_pipeline(USBRedirDevice *dev,
struct USBEndpoint *uep)
}
}
+static void usbredir_setup_usb_eps(USBRedirDevice *dev)
+{
+ struct USBEndpoint *usb_ep;
+ int i, pid;
+
+ for (i = 0; i < MAX_ENDPOINTS; i++) {
+ pid = (i & 0x10) ? USB_TOKEN_IN : USB_TOKEN_OUT;
+ usb_ep = usb_ep_get(&dev->dev, pid, i & 0x0f);
+ usb_ep->type = dev->endpoint[i].type;
+ usb_ep->ifnum = dev->endpoint[i].interface;
+ usb_ep->max_packet_size = dev->endpoint[i].max_packet_size;
+ usbredir_set_pipeline(dev, usb_ep);
+ }
+}
+
static void usbredir_ep_info(void *priv,
struct usb_redir_ep_info_header *ep_info)
{
USBRedirDevice *dev = priv;
- struct USBEndpoint *usb_ep;
int i;
for (i = 0; i < MAX_ENDPOINTS; i++) {
dev->endpoint[i].type = ep_info->type[i];
dev->endpoint[i].interval = ep_info->interval[i];
dev->endpoint[i].interface = ep_info->interface[i];
+ if (usbredirparser_peer_has_cap(dev->parser,
+ usb_redir_cap_ep_info_max_packet_size)) {
+ dev->endpoint[i].max_packet_size = ep_info->max_packet_size[i];
+ }
switch (dev->endpoint[i].type) {
case usb_redir_type_invalid:
break;
@@ -1367,18 +1385,8 @@ static void usbredir_ep_info(void *priv,
usbredir_device_disconnect(dev);
return;
}
- usb_ep = usb_ep_get(&dev->dev,
- (i & 0x10) ? USB_TOKEN_IN : USB_TOKEN_OUT,
- i & 0x0f);
- usb_ep->type = dev->endpoint[i].type;
- usb_ep->ifnum = dev->endpoint[i].interface;
- if (usbredirparser_peer_has_cap(dev->parser,
- usb_redir_cap_ep_info_max_packet_size)) {
- dev->endpoint[i].max_packet_size =
- usb_ep->max_packet_size = ep_info->max_packet_size[i];
- }
- usbredir_set_pipeline(dev, usb_ep);
}
+ usbredir_setup_usb_eps(dev);
}
static void usbredir_configuration_status(void *priv, uint64_t id,
@@ -1620,8 +1628,6 @@ static void usbredir_pre_save(void *priv)
static int usbredir_post_load(void *priv, int version_id)
{
USBRedirDevice *dev = priv;
- struct USBEndpoint *usb_ep;
- int i;
switch (dev->device_info.speed) {
case usb_redir_speed_low:
@@ -1641,15 +1647,8 @@ static int usbredir_post_load(void *priv, int version_id)
}
dev->dev.speedmask = (1 << dev->dev.speed);
- for (i = 0; i < MAX_ENDPOINTS; i++) {
- usb_ep = usb_ep_get(&dev->dev,
- (i & 0x10) ? USB_TOKEN_IN : USB_TOKEN_OUT,
- i & 0x0f);
- usb_ep->type = dev->endpoint[i].type;
- usb_ep->ifnum = dev->endpoint[i].interface;
- usb_ep->max_packet_size = dev->endpoint[i].max_packet_size;
- usbredir_set_pipeline(dev, usb_ep);
- }
+ usbredir_setup_usb_eps(dev);
+
return 0;
}
--
1.7.12.1
- [Qemu-devel] usb input pipelining patches v3, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 6/8] usb-redir: Use reject rather the disconnect on bad ep info, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 1/8] usb: Add packet combining functions, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 4/8] usb-redir: Add support for input pipelining, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 5/8] usb-redir: Add an usbredir_setup_usb_eps() helper function,
Hans de Goede <=
- [Qemu-devel] [PATCH 2/8] combined-packet: Add a workaround for Linux usbfs + live migration, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 7/8] usb-redir: Allow to attach USB 2.0 devices to 1.1 host controller, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 3/8] usb-redir: Add support for 32 bits bulk packet length, Hans de Goede, 2012/10/31
- [Qemu-devel] [PATCH 8/8] usb-redir: Allow redirecting super speed devices to high speed controllers, Hans de Goede, 2012/10/31