Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small sys_usbd changes #7463

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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