[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/24] usb: add attach callback
From: |
Gerd Hoffmann |
Subject: |
[Qemu-devel] [PATCH 20/24] usb: add attach callback |
Date: |
Thu, 9 Dec 2010 13:30:23 +0100 |
Add handle_attach() callback to USBDeviceInfo which is called by the
generic package handler when the device is attached to the usb bus
(i.e. plugged into a port).
Signed-off-by: Gerd Hoffmann <address@hidden>
---
hw/usb.c | 7 ++++++-
hw/usb.h | 5 +++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/hw/usb.c b/hw/usb.c
index ba720b4..82a6217 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -194,6 +194,9 @@ int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
switch(p->pid) {
case USB_MSG_ATTACH:
s->state = USB_STATE_ATTACHED;
+ if (s->info->handle_attach) {
+ s->info->handle_attach(s);
+ }
return 0;
case USB_MSG_DETACH:
@@ -204,7 +207,9 @@ int usb_generic_handle_packet(USBDevice *s, USBPacket *p)
s->remote_wakeup = 0;
s->addr = 0;
s->state = USB_STATE_DEFAULT;
- s->info->handle_reset(s);
+ if (s->info->handle_reset) {
+ s->info->handle_reset(s);
+ }
return 0;
}
diff --git a/hw/usb.h b/hw/usb.h
index 864501a..0219816 100644
--- a/hw/usb.h
+++ b/hw/usb.h
@@ -194,6 +194,11 @@ struct USBDeviceInfo {
void (*handle_destroy)(USBDevice *dev);
/*
+ * Attach the device
+ */
+ void (*handle_attach)(USBDevice *dev);
+
+ /*
* Reset the device
*/
void (*handle_reset)(USBDevice *dev);
--
1.7.1
- [Qemu-devel] [PATCH 08/24] usb descriptors: add settable strings., (continued)
- [Qemu-devel] [PATCH 08/24] usb descriptors: add settable strings., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 11/24] usb: move USB_REQ_SET_ADDRESS handling to common code, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 05/24] usb wacom: use new descriptor infrastructure., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 07/24] usb hub: use new descriptor infrastructure., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 14/24] usb: create USBPortOps, move attach there., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 06/24] usb bluetooth: use new descriptor infrastructure., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 12/24] usb: move USB_REQ_{GET, SET}_CONFIGURATION handling to common code, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 10/24] usb network: use new descriptor infrastructure., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 13/24] usb: move remote wakeup handling to common code, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 16/24] usb: add usb_wakeup() + wakeup callback to port ops, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 20/24] usb: add attach callback,
Gerd Hoffmann <=
- [Qemu-devel] [PATCH 17/24] usb: uhci: remote wakeup support., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 18/24] usb: hid: remote wakeup support., Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 15/24] usb: rework attach/detach workflow, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 23/24] usb storage: high speed support, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 21/24] usb: add usb_desc_attach, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 19/24] usb: add speed mask to ports, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 22/24] usb: add device qualifier support, Gerd Hoffmann, 2010/12/09
- [Qemu-devel] [PATCH 24/24] usb storage: fix status reporting, Gerd Hoffmann, 2010/12/09