[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCHv3 10/14] Add get_dev_path callback for usb bus.
From: |
Gleb Natapov |
Subject: |
[Qemu-devel] [PATCHv3 10/14] Add get_dev_path callback for usb bus. |
Date: |
Wed, 10 Nov 2010 19:14:17 +0200 |
Signed-off-by: Gleb Natapov <address@hidden>
---
hw/usb-bus.c | 35 +++++++++++++++++++++++++++++++++++
1 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/hw/usb-bus.c b/hw/usb-bus.c
index 256b881..6292282 100644
--- a/hw/usb-bus.c
+++ b/hw/usb-bus.c
@@ -5,11 +5,13 @@
#include "monitor.h"
static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);
+static char *usbbus_get_fw_dev_path(DeviceState *dev);
static struct BusInfo usb_bus_info = {
.name = "USB",
.size = sizeof(USBBus),
.print_dev = usb_bus_dev_print,
+ .get_fw_dev_path = usbbus_get_fw_dev_path,
};
static int next_usb_bus = 0;
static QTAILQ_HEAD(, USBBus) busses = QTAILQ_HEAD_INITIALIZER(busses);
@@ -307,3 +309,36 @@ USBDevice *usbdevice_create(const char *cmdline)
}
return usb->usbdevice_init(params);
}
+
+static int usbbus_get_fw_dev_path_helper(USBDevice *d, USBBus *bus, char *p,
+ int len)
+{
+ int l = 0;
+ USBPort *port;
+
+ QTAILQ_FOREACH(port, &bus->used, next) {
+ if (port->dev != d)
+ continue;
+
+ if (port->pdev) {
+ l = usbbus_get_fw_dev_path_helper(port->pdev, bus, p, len);
+ }
+ l += snprintf(p + l, len - l, "address@hidden/",
qdev_fw_name(&d->qdev),
+ port->index);
+ return l;
+ }
+ return 0;
+}
+
+static char *usbbus_get_fw_dev_path(DeviceState *dev)
+{
+ USBDevice *d = (USBDevice*)dev;
+ USBBus *bus = usb_bus_from_device(d);
+ char path[100];
+ int l;
+
+ l = usbbus_get_fw_dev_path_helper(d, bus, path, sizeof(path));
+ path[l-1] = '\0';
+
+ return strdup(path);
+}
--
1.7.1
- [Qemu-devel] [PATCHv3 00/14] boot order specification, Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 02/14] Introduce new BusInfo callback get_fw_dev_path., Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 01/14] Introduce fw_name field to DeviceInfo structure., Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 04/14] Add get_fw_dev_path callback to ISA bus in qdev., Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 10/14] Add get_dev_path callback for usb bus.,
Gleb Natapov <=
- [Qemu-devel] [PATCHv3 06/14] Add get_fw_dev_path callback to IDE bus., Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 07/14] Add get_dev_path callback for system bus., Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 03/14] Keep track of ISA ports ISA device is using in qdev., Gleb Natapov, 2010/11/10
- [Qemu-devel] [PATCHv3 08/14] Add get_fw_dev_path callback for pci bus., Gleb Natapov, 2010/11/10