From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gerd Hoffmann <kraxel@redhat.com>
Subject: [Qemu-devel] [PATCH 11/12] usb: move USB_REQ_SET_ADDRESS handling to common code
Date: Mon, 29 Nov 2010 17:04:08 +0100 [thread overview]
Message-ID: <1291046649-19353-12-git-send-email-kraxel@redhat.com> (raw)
In-Reply-To: <1291046649-19353-1-git-send-email-kraxel@redhat.com>
USB_REQ_SET_ADDRESS handling is identical in *all* emulated devices.
Move it to common code.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb-bt.c | 4 ----
hw/usb-desc.c | 4 ++++
hw/usb-hid.c | 4 ----
hw/usb-hub.c | 4 ----
hw/usb-msd.c | 4 ----
hw/usb-net.c | 5 -----
hw/usb-serial.c | 4 ----
hw/usb-wacom.c | 4 ----
8 files changed, 4 insertions(+), 29 deletions(-)
diff --git a/hw/usb-bt.c b/hw/usb-bt.c
index 44da655..cb51750 100644
--- a/hw/usb-bt.c
+++ b/hw/usb-bt.c
@@ -412,10 +412,6 @@ static int usb_bt_handle_control(USBDevice *dev, int request, int value,
}
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = 1;
ret = 1;
diff --git a/hw/usb-desc.c b/hw/usb-desc.c
index 59af8e2..36dabec 100644
--- a/hw/usb-desc.c
+++ b/hw/usb-desc.c
@@ -268,6 +268,10 @@ int usb_desc_handle_control(USBDevice *dev, int request, int value,
assert(desc != NULL);
switch(request) {
+ case DeviceOutRequest | USB_REQ_SET_ADDRESS:
+ dev->addr = value;
+ ret = 0;
+ break;
case DeviceRequest | USB_REQ_GET_DESCRIPTOR:
ret = usb_desc_get_descriptor(dev, value, data, length);
break;
diff --git a/hw/usb-hid.c b/hw/usb-hid.c
index 2efdc3b..a5e3804 100644
--- a/hw/usb-hid.c
+++ b/hw/usb-hid.c
@@ -694,10 +694,6 @@ static int usb_hid_handle_control(USBDevice *dev, int request, int value,
}
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = 1;
ret = 1;
diff --git a/hw/usb-hub.c b/hw/usb-hub.c
index 0f8d060..51a67a2 100644
--- a/hw/usb-hub.c
+++ b/hw/usb-hub.c
@@ -297,10 +297,6 @@ static int usb_hub_handle_control(USBDevice *dev, int request, int value,
}
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = 1;
ret = 1;
diff --git a/hw/usb-msd.c b/hw/usb-msd.c
index 7b6a0d7..a4d5c49 100644
--- a/hw/usb-msd.c
+++ b/hw/usb-msd.c
@@ -260,10 +260,6 @@ static int usb_msd_handle_control(USBDevice *dev, int request, int value,
}
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = 1;
ret = 1;
diff --git a/hw/usb-net.c b/hw/usb-net.c
index 057c753..502a079 100644
--- a/hw/usb-net.c
+++ b/hw/usb-net.c
@@ -1071,11 +1071,6 @@ static int usb_net_handle_control(USBDevice *dev, int request, int value,
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
-
case ClassInterfaceOutRequest | USB_CDC_SEND_ENCAPSULATED_COMMAND:
if (!s->rndis || value || index != 0)
goto fail;
diff --git a/hw/usb-serial.c b/hw/usb-serial.c
index 85d8d3f..e3cc49a 100644
--- a/hw/usb-serial.c
+++ b/hw/usb-serial.c
@@ -253,10 +253,6 @@ static int usb_serial_handle_control(USBDevice *dev, int request, int value,
}
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = 1;
ret = 1;
diff --git a/hw/usb-wacom.c b/hw/usb-wacom.c
index d0263a6..6b50b06 100644
--- a/hw/usb-wacom.c
+++ b/hw/usb-wacom.c
@@ -283,10 +283,6 @@ static int usb_wacom_handle_control(USBDevice *dev, int request, int value,
}
ret = 0;
break;
- case DeviceOutRequest | USB_REQ_SET_ADDRESS:
- dev->addr = value;
- ret = 0;
- break;
case DeviceRequest | USB_REQ_GET_CONFIGURATION:
data[0] = 1;
ret = 1;
--
1.7.1
next prev parent reply other threads:[~2010-11-29 16:04 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-29 16:03 [Qemu-devel] [PATCH 00/12] usb descriptor overhaul Gerd Hoffmann
2010-11-29 16:03 ` [Qemu-devel] [PATCH 01/12] usb: data structs and helpers for usb descriptors Gerd Hoffmann
2010-11-29 16:03 ` [Qemu-devel] [PATCH 02/12] usb hid: use new descriptor infrastructure Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 03/12] usb serial: " Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 04/12] usb storage: " Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 05/12] usb wacom: " Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 06/12] usb bluetooth: " Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 07/12] usb hub: " Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 08/12] usb descriptors: add settable strings Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 09/12] usb storage: serial number support Gerd Hoffmann
2010-11-29 16:04 ` [Qemu-devel] [PATCH 10/12] usb network: use new descriptor infrastructure Gerd Hoffmann
2010-11-29 16:04 ` Gerd Hoffmann [this message]
2010-11-29 16:04 ` [Qemu-devel] [PATCH 12/12] usb: move USB_REQ_{GET, SET}_CONFIGURATION handling to common code 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=1291046649-19353-12-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).