psp-uvc-usb-video-class
psp-uvc-usb-video-class copied to clipboard
Windows 10: Device cannot start
Hey xerpi.
I'm trying this plugin on PSP1001 + 6.61 ME 2.3. Both VSH + GAME plugins activated. Windows 10 LTSC + Privacy "Camera" Settings Enabled. Official Dual Shock 3 cable (never had any problems with it) + different USB 2.0/3.0 ports.
And I'm getting USB Video Device, under Cameras group, with exclamation mark (This device cannot start. (Code 10) An invalid parameter was passed to a service or function).
vita-usvc-usb-video-class works perfectly fine tho.
Any idea? Thank you.
I think the problem is that I'm not setting an Interface Association Descriptor (IAD), which is mandatory per the UVC spec. You can see the difference here: PSP (https://pastebin.com/raw/Ex59Hzvy) vs PSVita (https://pastebin.com/raw/rBvzgFuU). As you can see the PSP one is missing:
Interface Association:
bLength 8
bDescriptorType 11
bFirstInterface 0
bInterfaceCount 2
bFunctionClass 14 Video
bFunctionSubClass 3 Video Interface Collection
bFunctionProtocol 0
iFunction 0
For that, we need to hook the pspusb module and inject IAD.
I works on Android using USB Camera software. I guess it requires less header/info than Windows UVC.
Is the debug info scrolling through the screen normal? 😄
With hooking the descriptor to usb module I assume you have to do that change, or can I change that in the code?
Thanks again.
Set https://github.com/xerpi/psp-uvc-usb-video-class/blob/master/src/main.c#L11 to 0 to disable the debug logging.
Regarding IAD, we have to reverse-engineer the USB module usb.prx (decrypt 6.6X modules and use Ghidra) to find and understand the function that writes and serializes all the descriptors in a buffer that is sent to the USB hardware. Then we can hook that function and memmove and memcpy IAD to that buffer. This is what I do on the PSVita plugin: https://github.com/xerpi/vita-udcd-uvc/blob/master/src/main.c#L947
I think I've found the function that we are looking for, in 6.61 OFW usb.prx.
~It is at offset 0x00008440, and takes a UsbDriver *driver as a parameter. It is called during sceUsbStart.~
EDIT: I correct myself: it's at offset 0x000019c0 and takes 2 parameters: the first one is struct ConfigDescriptor *config and the second one is byte *buffer where the Configuration Descriptor is serialized into.
Thank you. I will wait for the push then.
Great work 👍
I think I've found a clean way to include the IAD without having to hook anything :) Can you try the latest code in master?
This time I'm not getting the 'Camera' tab and, instead, the exclamation mark is in USB Composite Device, under 'USB Controllers'.
This device cannot start. (Code 10) STATUS_DEVICE_DATA_ERROR
Device USB\VID_054C&PID_1337\0487B0543E0C09E0 was configured. Driver Name: usb.inf Class Guid: {36fc9e60-c465-11cf-8056-444553540000} Driver Date: 06/21/2006 Driver Version: 10.0.17763.1432 Driver Provider: Microsoft Driver Section: Composite.Dev.NT Driver Rank: 0xFF2003 Matching Device Id: USB\COMPOSITE Outranked Drivers: Device Updated: false Parent Device: USB\ROOT_HUB30\4&92b3c53&0&0
Device USB\VID_054C&PID_1337\0487B0543E0C09E0 was started. Driver Name: usb.inf Class Guid: {36fc9e60-c465-11cf-8056-444553540000} Service: usbccgp Lower Filters: Upper Filters:
USB Camera on Android still works fine.

@xerpi Update: Fixed! (partially).
With your latest change I'm getting two USB Video Devices. One correctly detected under Cameras tab, the other still marked with an exclamation mark under Other devices.

But the first one works perfecly fine on OBS or VirtualDub.

Only issues left: 1) If you turn off the screen (both Backlight Auto-Off or using the slider) the PSP turns off. 2) That extra device. 3) A custom PSP UVC ID would be great, like PSVita on Vita, instead of 'USB Video Device'.
Can you try with 0.2? https://github.com/xerpi/psp-uvc-usb-video-class/releases
Yes, I've also noticed that second extra "Unknown device" that appears. I'm sure it's due to the dummy USB interface I'm adding: https://github.com/xerpi/psp-uvc-usb-video-class/blob/master/include/usb_descriptors.h#L224 Maybe we could try to play with its values a bit to see if we make it Windows completely ignore.
And regarding the custom string descriptors, yeah that would be nice but I doubt I'll continue working on this very often.. so I'd really like if other devs could help improve it :)
Sorry. I didn't get the notification. Yes. 0.2 worked fine, as the last build I tried.
I'm afraid I can't help you with this other than testing and reporting issues. Good luck with your future projects 👍