mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
usb: add usb_find_device()
Add usb_find_device(). This function will check whenever a device with a specific address is connected to the specified port. Usually this will just check state and address of the device hooked up to the port, but in case of a hub it will ask the hub to check all hub ports for a matching device. This patch doesn't put the code into use yet, see the following patches for details. The master plan is to separate device lookup and packet processing. Right now the usb code simply walks all devices, calls usb_handle_packet() on each until one accepts the packet (by returning something different that USB_RET_NODEV). I want to have a device lookup first, then call usb_handle_packet() once, for the device which actually processes the packet. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This commit is contained in:
parent
70fc20d4dc
commit
73796fe622
3 changed files with 32 additions and 0 deletions
|
@ -74,6 +74,15 @@ static int usb_device_init(USBDevice *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
USBDevice *usb_device_find_device(USBDevice *dev, uint8_t addr)
|
||||
{
|
||||
USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
|
||||
if (klass->find_device) {
|
||||
return klass->find_device(dev, addr);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void usb_device_handle_destroy(USBDevice *dev)
|
||||
{
|
||||
USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue