Il 13/06/2012 01:14, Kevin O'Connor ha scritto:
On Tue, Jun 12, 2012 at 06:21:39PM +0200, Paolo Bonzini wrote:
Il 12/06/2012 03:32, Kevin O'Connor ha scritto:
-int bootprio_find_usb(struct usbdevice_s *usbdev) +int bootprio_find_usb(struct usbdevice_s *usbdev, int lun) { if (!CONFIG_BOOTORDER) return -1;
- // Find usb - for example: /pci@i0cf8/usb@1,2/hub@1/network@0/ethernet@0
- // Find usb - for example: /pci@i0cf8/usb@1,2/storage@1/channel@0/disk@0,0 char desc[256], *p; p = build_pci_path(desc, sizeof(desc), "usb", usbdev->hub->cntl->pci); p = build_usb_path(p, desc+sizeof(desc)-p, usbdev->hub);
- snprintf(p, desc+sizeof(desc)-p, "/*@%x", usbdev->port+1);
- snprintf(p, desc+sizeof(desc)-p, "/*@%x/*@0/*@0,%d", usbdev->port+1, lun); return find_prio(desc);
This will not work if you're redirecting a USB device from the host, because then you will not have the SCSI-specific elements of the path. I suggest that you fall back to "/*@%x" if find_prio returns failure and lun=0.
Do you have an example of the bootorder syntax found for USB passthrough?
It's also something like /pci@i0cf8/usb@1,2/*@1, but * could be usb-host or usb-redir (the latter for USB-over-IP).
Can we add a parameter to find_prio for "do not match a longer string"?
Paolo
The problem is that a shorter pattern match will match a longer string. So, if the bootorder contains:
/pci@i0cf8/usb@1,2/storage@1/channel@0/disk@0,1
and we search for "/pci@i0cf8/usb@1,2/storage@1/channel@0/disk@0,0" (no match) followed by a search for "/pci@i0cf8/usb@1,2" then we'll match even though we clearly intended to catch the lun=1 disk and not the lun=0 disk.
I'm not sure what the solution is.
-Kevin