* [Qemu-devel] [RFC, PATCH] usb_del support host:
[not found] ` <6528d9420710110710j4a8d5dfcpa7a6df75ec1770b8@mail.gmail.com>
@ 2007-10-11 15:00 ` Yuval Kashtan
0 siblings, 0 replies; only message in thread
From: Yuval Kashtan @ 2007-10-11 15:00 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1.1: Type: text/plain, Size: 492 bytes --]
Hello,
This proposed patch add support for deleting usb devices by providing the
(exact) same string they were added with, thus enabling to remove a usb
device with the host string.
The old capability of deleting usb device by their internal port is not
harmed.
I had to move USBHostDevice to vl.h so that I will be able to reference it
from vl.c
and last, I've changed the output of info usb so that it will include the
saved string (for reference).
Please comment.
BR,
Yuval Kashtan.
[-- Attachment #1.2: Type: text/html, Size: 542 bytes --]
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: usb_del.patch --]
[-- Type: text/x-patch; name="usb_del.patch", Size: 2797 bytes --]
diff -Naur qemu.orig/usb-linux.c qemu.usb/usb-linux.c
--- qemu.orig/usb-linux.c 2007-10-09 13:27:39.000000000 +0200
+++ qemu.usb/usb-linux.c 2007-10-09 15:04:46.000000000 +0200
@@ -56,27 +56,9 @@
#define USBDEVFS_PATH "/proc/bus/usb"
#define PRODUCT_NAME_SZ 32
#define SIG_ISOCOMPLETE (SIGRTMIN+7)
-#define MAX_ENDPOINTS 16
struct sigaction sigact;
-/* endpoint association data */
-struct endp_data {
- uint8_t type;
-};
-
-/* FIXME: move USBPacket to PendingURB */
-typedef struct USBHostDevice {
- USBDevice dev;
- int fd;
- USBPacket *packet;
- struct endp_data endp_table[MAX_ENDPOINTS];
- int configuration;
- uint8_t descr[1024];
- int descr_len;
- int urbs_ready;
-} USBHostDevice;
-
typedef struct PendingURB {
struct usbdevfs_urb *urb;
USBHostDevice *dev;
diff -Naur qemu.orig/vl.c qemu.usb/vl.c
--- qemu.orig/vl.c 2007-10-09 13:01:16.000000000 +0200
+++ qemu.usb/vl.c 2007-10-09 15:04:36.000000000 +0200
@@ -4743,6 +4743,9 @@
free_usb_ports = port->next;
port->next = used_usb_ports;
used_usb_ports = port;
+ pstrcpy (((USBHostDevice *)dev)->szDeviceName,
+ 20,
+ devname);
usb_attach(port, dev);
return 0;
}
@@ -4768,7 +4771,8 @@
lastp = &used_usb_ports;
port = used_usb_ports;
- while (port && port->dev->addr != addr) {
+ while (port && port->dev->addr != addr && strcmp (((USBHostDevice *)(port->dev))->szDeviceName,
+ devname) != 0) {
lastp = &port->next;
port = port->next;
}
@@ -4830,8 +4834,8 @@
speed_str = "?";
break;
}
- term_printf(" Device %d.%d, Speed %s Mb/s, Product %s\n",
- 0, dev->addr, speed_str, dev->devname);
+ term_printf(" Device %d.%d[%s], Speed %s Mb/s, Product %s\n",
+ 0, dev->addr, ((USBHostDevice *)dev)->szDeviceName, speed_str, dev->devname);
}
}
diff -Naur qemu.orig/vl.h qemu.usb/vl.h
--- qemu.orig/vl.h 2007-10-09 13:01:19.000000000 +0200
+++ qemu.usb/vl.h 2007-10-09 15:04:36.000000000 +0200
@@ -1394,6 +1394,30 @@
#include "hw/usb.h"
+#if defined(__linux__)
+#include <linux/compiler.h>
+#include <linux/usbdevice_fs.h>
+
+#define MAX_ENDPOINTS 16
+
+/* endpoint association data */
+struct endp_data {
+ uint8_t type;
+};
+
+/* FIXME: move USBPacket to PendingURB */
+typedef struct USBHostDevice {
+ USBDevice dev;
+ int fd;
+ USBPacket *packet;
+ struct endp_data endp_table[MAX_ENDPOINTS];
+ int configuration;
+ uint8_t descr[1024];
+ int descr_len;
+ int urbs_ready;
+ char szDeviceName[20];
+} USBHostDevice;
+#endif
/* usb ports of the VM */
void qemu_register_usb_port(USBPort *port, void *opaque, int index,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-10-11 15:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <6528d9420710090615s56afab0fi34ee5d3440b17bc3@mail.gmail.com>
[not found] ` <6528d9420710110710j4a8d5dfcpa7a6df75ec1770b8@mail.gmail.com>
2007-10-11 15:00 ` [Qemu-devel] [RFC, PATCH] usb_del support host: Yuval Kashtan
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).