The loop in usbstorage.c#__usbstorage_IsInserted (referenced in the first link below) breaks as soon as it finds any USB storage device. If a drive with an unreadable proprietary format (e.g. a Wii U formatted drive) happens to appear ahead of a readable drive (e.g. a FAT32 Wii USB drive) in the usb_device_entry buffer, usbstorage.c will mount it and exit the function. This may cause issues in higher level apps which rely on this function to mount a USB storage drive when multiple USB storage drives are connected and some subset of them are in an unreadable proprietary format.
|
for (i = 0; i < device_count; i++) { |
|
vid = buffer[i].vid; |
|
pid = buffer[i].pid; |
|
if (vid == 0 || pid == 0) |
|
continue; |
|
|
|
if (vid == 0x0b95 && pid == 0x7720) // USB LAN |
|
continue; |
|
|
|
if (USBStorage_Open(&__usbfd, buffer[i].device_id, vid, pid) < 0) |
|
continue; |
|
|
|
maxLun = USBStorage_GetMaxLUN(&__usbfd); |
|
for (j = 0; j < maxLun; j++) { |
|
retval = USBStorage_MountLUN(&__usbfd, j); |
|
|
|
if (retval == INVALID_LUN) |
|
continue; |
|
|
|
if (retval < 0) |
|
{ |
|
__usbstorage_reset(&__usbfd); |
|
continue; |
|
} |
|
|
|
__mounted = true; |
|
__lun = j; |
|
__vid = vid; |
|
__pid = pid; |
|
usb_last_used = gettime()-secs_to_ticks(100); |
|
usleep(10000); |
|
break; |
|
} |
|
|
|
if (__mounted) |
|
break; |
|
|
|
USBStorage_Close(&__usbfd); |
|
} |
This behavior affected WiiFlow on Wii U as documented in WiiFlow issue 338. WiiFlow contains its own modified copy of this function and a fix for the issue can be viewed in pull request 343. Opening this issue to track the problem in libogc and to note that the fix in WiiFlow could be adapted and included here if desired.
The loop in
usbstorage.c#__usbstorage_IsInserted(referenced in the first link below) breaks as soon as it finds any USB storage device. If a drive with an unreadable proprietary format (e.g. a Wii U formatted drive) happens to appear ahead of a readable drive (e.g. a FAT32 Wii USB drive) in theusb_device_entrybuffer,usbstorage.cwill mount it and exit the function. This may cause issues in higher level apps which rely on this function to mount a USB storage drive when multiple USB storage drives are connected and some subset of them are in an unreadable proprietary format.libogc/libogc/usbstorage.c
Lines 879 to 917 in 46b47a0
This behavior affected WiiFlow on Wii U as documented in WiiFlow issue 338. WiiFlow contains its own modified copy of this function and a fix for the issue can be viewed in pull request 343. Opening this issue to track the problem in
libogcand to note that the fix in WiiFlow could be adapted and included here if desired.