Small sys_usbd changes

This commit is contained in:
RipleyTom 2020-02-10 08:46:23 +01:00 committed by Ivan
parent 6847e52364
commit 98f91457bf
1 changed files with 11 additions and 5 deletions

View File

@ -136,7 +136,7 @@ usb_handler_thread::usb_handler_thread()
return;
// look if any device which we could be interested in is actually connected
libusb_device** list;
libusb_device** list = nullptr;
ssize_t ndev = libusb_get_device_list(ctx, &list);
bool found_skylander = false;
@ -191,7 +191,6 @@ usb_handler_thread::usb_handler_thread()
check_device(0x046D, 0xC220, 0xC220, "buzzer9");
}
if (ndev > 0)
libusb_free_device_list(list, 1);
if (!found_skylander)
@ -363,9 +362,12 @@ void usb_handler_thread::check_devices_vs_ldds()
{
for (const auto& dev : usb_devices)
{
if (dev->assigned_number)
continue;
for (const auto& ldd : ldds)
{
if (dev->device._device.idVendor == ldd.id_vendor && dev->device._device.idProduct >= ldd.id_product_min && dev->device._device.idProduct <= ldd.id_product_max && !dev->assigned_number)
if (dev->device._device.idVendor == ldd.id_vendor && dev->device._device.idProduct >= ldd.id_product_min && dev->device._device.idProduct <= ldd.id_product_max)
{
if (!dev->open_device())
{
@ -637,7 +639,7 @@ error_code sys_usbd_receive_event(ppu_thread& ppu, u32 handle, vm::ptr<u64> arg1
// hack for Guitar Hero Live
// Attaching the device too fast seems to result in a nullptr along the way
if (*arg1 == SYS_USBD_ATTACH)
lv2_obj::wait_timeout(5000);
lv2_obj::sleep(ppu), lv2_obj::wait_timeout(5000);
return CELL_OK;
}
@ -659,6 +661,10 @@ error_code sys_usbd_receive_event(ppu_thread& ppu, u32 handle, vm::ptr<u64> arg1
*arg1 = ppu.gpr[4];
*arg2 = ppu.gpr[5];
*arg3 = ppu.gpr[6];
if (*arg1 == SYS_USBD_ATTACH)
lv2_obj::sleep(ppu), lv2_obj::wait_timeout(5000);
return CELL_OK;
}