mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
USB: Allow UsbPspCm passthrough
This commit is contained in:
parent
c16e176fbe
commit
f1ef3bdcd7
3 changed files with 21 additions and 5 deletions
|
@ -363,6 +363,9 @@ usb_handler_thread::usb_handler_thread()
|
||||||
|
|
||||||
// Tony Hawk RIDE Skateboard
|
// Tony Hawk RIDE Skateboard
|
||||||
check_device(0x12BA, 0x0400, 0x0400, "Tony Hawk RIDE Skateboard Controller");
|
check_device(0x12BA, 0x0400, 0x0400, "Tony Hawk RIDE Skateboard Controller");
|
||||||
|
|
||||||
|
// PSP in UsbPspCm mode
|
||||||
|
check_device(0x054C, 0x01CB, 0x01CB, "UsbPspcm");
|
||||||
}
|
}
|
||||||
|
|
||||||
libusb_free_device_list(list, 1);
|
libusb_free_device_list(list, 1);
|
||||||
|
@ -588,7 +591,15 @@ void usb_handler_thread::transfer_complete(struct libusb_transfer* transfer)
|
||||||
case LIBUSB_TRANSFER_CANCELLED:
|
case LIBUSB_TRANSFER_CANCELLED:
|
||||||
case LIBUSB_TRANSFER_STALL:
|
case LIBUSB_TRANSFER_STALL:
|
||||||
case LIBUSB_TRANSFER_NO_DEVICE:
|
case LIBUSB_TRANSFER_NO_DEVICE:
|
||||||
default: usbd_transfer->result = EHCI_CC_HALTED; break;
|
default:
|
||||||
|
usbd_transfer->result = EHCI_CC_HALTED;
|
||||||
|
if (usbd_transfer->assigned_number && handled_devices.erase(usbd_transfer->assigned_number))
|
||||||
|
{
|
||||||
|
send_message(SYS_USBD_DETACH, usbd_transfer->assigned_number);
|
||||||
|
sys_usbd.warning("USB transfer failed, detach the device %d", usbd_transfer->assigned_number);
|
||||||
|
usbd_transfer->assigned_number = 0;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
usbd_transfer->count = transfer->actual_length;
|
usbd_transfer->count = transfer->actual_length;
|
||||||
|
@ -971,6 +982,7 @@ error_code sys_usbd_register_ldd(ppu_thread& ppu, u32 handle, vm::cptr<char> s_p
|
||||||
// Unsure how many more devices might need similar treatment (i.e. just a compare and force VID/PID add), or if it's worth adding a full promiscuous capability
|
// Unsure how many more devices might need similar treatment (i.e. just a compare and force VID/PID add), or if it's worth adding a full promiscuous capability
|
||||||
static const std::unordered_map<std::string, UsbLdd, fmt::string_hash, std::equal_to<>> predefined_ldds
|
static const std::unordered_map<std::string, UsbLdd, fmt::string_hash, std::equal_to<>> predefined_ldds
|
||||||
{
|
{
|
||||||
|
{"cellUsbPspcm", {0x054C, 0x01CB, 0x01CB}},
|
||||||
{"guncon3", {0x0B9A, 0x0800, 0x0800}},
|
{"guncon3", {0x0B9A, 0x0800, 0x0800}},
|
||||||
{"PS3A-USJ", {0x0B9A, 0x0900, 0x0910}}
|
{"PS3A-USJ", {0x0B9A, 0x0900, 0x0910}}
|
||||||
};
|
};
|
||||||
|
@ -995,11 +1007,12 @@ error_code sys_usbd_unregister_ldd(ppu_thread& ppu, u32 handle, vm::cptr<char> s
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: determine what the unknown params are
|
// TODO: determine what the unknown params are
|
||||||
error_code sys_usbd_open_pipe(ppu_thread& ppu, u32 handle, u32 device_handle, u32 unk1, u64 unk2, u64 unk3, u32 endpoint, u64 unk4)
|
// attributes (bmAttributes) : 2=Bulk, 3=Interrupt
|
||||||
|
error_code sys_usbd_open_pipe(ppu_thread& ppu, u32 handle, u32 device_handle, u32 unk1, u64 unk2, u64 unk3, u32 endpoint, u64 attributes)
|
||||||
{
|
{
|
||||||
ppu.state += cpu_flag::wait;
|
ppu.state += cpu_flag::wait;
|
||||||
|
|
||||||
sys_usbd.warning("sys_usbd_open_pipe(handle=0x%x, device_handle=0x%x, unk1=0x%x, unk2=0x%x, unk3=0x%x, endpoint=0x%x, unk4=0x%x)", handle, device_handle, unk1, unk2, unk3, endpoint, unk4);
|
sys_usbd.warning("sys_usbd_open_pipe(handle=0x%x, device_handle=0x%x, unk1=0x%x, unk2=0x%x, unk3=0x%x, endpoint=0x%x, attributes=0x%x)", handle, device_handle, unk1, unk2, unk3, endpoint, attributes);
|
||||||
|
|
||||||
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
auto& usbh = g_fxo->get<named_thread<usb_handler_thread>>();
|
||||||
|
|
||||||
|
@ -1166,6 +1179,8 @@ error_code sys_usbd_transfer_data(ppu_thread& ppu, u32 handle, u32 id_pipe, vm::
|
||||||
const auto& pipe = usbh.get_pipe(id_pipe);
|
const auto& pipe = usbh.get_pipe(id_pipe);
|
||||||
auto&& [transfer_id, transfer] = usbh.get_free_transfer();
|
auto&& [transfer_id, transfer] = usbh.get_free_transfer();
|
||||||
|
|
||||||
|
transfer.assigned_number = pipe.device->assigned_number;
|
||||||
|
|
||||||
// Default endpoint is control endpoint
|
// Default endpoint is control endpoint
|
||||||
if (pipe.endpoint == 0)
|
if (pipe.endpoint == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -85,7 +85,7 @@ void usb_device_passthrough::send_libusb_transfer(libusb_transfer* transfer)
|
||||||
case LIBUSB_ERROR_BUSY: continue;
|
case LIBUSB_ERROR_BUSY: continue;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
sys_usbd.error("Unexpected error from libusb_submit_transfer: %d", res);
|
sys_usbd.error("Unexpected error from libusb_submit_transfer: %d(%s)", res, libusb_error_name(res));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ void usb_device_passthrough::read_descriptors()
|
||||||
int ssize = libusb_control_transfer(lusb_handle, +LIBUSB_ENDPOINT_IN | +LIBUSB_REQUEST_TYPE_STANDARD | +LIBUSB_RECIPIENT_DEVICE, LIBUSB_REQUEST_GET_DESCRIPTOR, 0x0200 | index, 0, buf, 1000, 0);
|
int ssize = libusb_control_transfer(lusb_handle, +LIBUSB_ENDPOINT_IN | +LIBUSB_REQUEST_TYPE_STANDARD | +LIBUSB_RECIPIENT_DEVICE, LIBUSB_REQUEST_GET_DESCRIPTOR, 0x0200 | index, 0, buf, 1000, 0);
|
||||||
if (ssize < 0)
|
if (ssize < 0)
|
||||||
{
|
{
|
||||||
sys_usbd.fatal("Couldn't get the config from the device: %d", ssize);
|
sys_usbd.fatal("Couldn't get the config from the device: %d(%s)", ssize, libusb_error_name(ssize));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -88,6 +88,7 @@ struct UsbDeviceHID
|
||||||
|
|
||||||
struct UsbTransfer
|
struct UsbTransfer
|
||||||
{
|
{
|
||||||
|
u32 assigned_number = 0;
|
||||||
u32 transfer_id = 0;
|
u32 transfer_id = 0;
|
||||||
|
|
||||||
s32 result = 0;
|
s32 result = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue