Skip to content

Commit

Permalink
Small sys_usbd changes
Browse files Browse the repository at this point in the history
  • Loading branch information
RipleyTom authored and Nekotekina committed Feb 10, 2020
1 parent 6847e52 commit 98f9145
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions rpcs3/Emu/Cell/lv2/sys_usbd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -191,8 +191,7 @@ usb_handler_thread::usb_handler_thread()
check_device(0x046D, 0xC220, 0xC220, "buzzer9");
}

if (ndev > 0)
libusb_free_device_list(list, 1);
libusb_free_device_list(list, 1);

if (!found_skylander)
{
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}

Expand Down

0 comments on commit 98f9145

Please sign in to comment.