usbd: Implement libusb passthrough#2271
Conversation
|
Lego Dimensions has this block of code, taken from Ghidra: which, since on Windows sceUsbdDetachKernelDriver will error LIBUSB_ERROR_NOT_SUPPORTED, will need handled on unsupported platforms to pass this. |
|
Now since sceUsbdKernelDriverActive returns 0 it still doesn't pass this condition, so like the condition says it will need to return 1. For future proofing for games that may check sceUsbdKernelDriverActive after detaching it and think it's still attached though, I'd recommend storing the state of attachment in a variable and returning that. |
|
libusb_kernel_driver_active returns 0 if no kernel driver is active though - not sure why I would pass 1 back? The initial (iVar13 != 1) will return true, which then means it will go straight to the sceUsbdResetDevice line. Unless it is unwanted behaviour to be heading to the sceUsbdResetDevice line, because the game is assuming it will return 1? |
Exactly. |
|
This is an example of libusb in action, getting past the no portal screen in Skylanders: Trap Team; https://youtu.be/G8ydGRB1pJw |
|
looking nice , i will try it on windows as well :) |
|
Welp, at least it doesn't crash. Will see if I can test on Windows to see why it doesn't work there, my assumption would be some byte order issue |
|
it stucks here in main as well |
|
I assume you had a USB portal plugged in? On windows, winUSB drivers will need to be installed as well, the default HID drivers don't work with libusb |
|
oh need to have a USB portal to pass it :? (thought it was just skipping it) |
|
Yes sorry should have made that clear - the games will require a USB peripheral like you would use on your PS4 normally to be attached, specifically for Trap Team in order to get past the please plug in a portal screen it requires a portal plugged in |
4cd4a78 to
5c77259
Compare
|
What driver did you have installed for your ToyPad? |
|
Not having much luck with LEGO Dimensions either, on Mac. I'm also getting occasional crashes while the game boots in With |
|
Thanks for testing, might need to get myself the Dimensions starter set for PS4 to do some testing locally |
5c77259 to
cbd33de
Compare
cbd33de to
abb8c8e
Compare
|
this needs some testing :D |
abb8c8e to
1485f85
Compare
|
I tried to test Lego Dimensions on my Mac, but the game crashes immediately after opening so will need some more time to test on a Windows machine |
|
any update on this? |
|
I'd test it for LEGO Dimensions on windows but I'm not specifically great on building the emulator correctly. If someone can provide me with a build of the emulator that includes this modification I can go ahead and test as I have the game |
|
i did rebase it , you will find a link here in a while |
|
Where am I supposed to download this branch? I can't find the link you mentioned |
|
testers you can also test games that were spamming usb lib stuff (driverclub for example) |
|
tested a bit on windows , doesn't seem to create issues in games that calls usb , so let's get it in main so it can be tested :D |
|
Didn't work for me on Windows either, here's the log. |
* usbd: Implement libusb passthrough * clang-format * only do kernel activities on non-windows * use variable to represent "fake" windows kernel driver --------- Co-authored-by: georgemoralis <giorgosmrls@gmail.com>
|
It's not working for me on Windows, trying Skylanders: Trap Team with its portal. |
* usbd: Implement libusb passthrough * clang-format * only do kernel activities on non-windows * use variable to represent "fake" windows kernel driver --------- Co-authored-by: georgemoralis <giorgosmrls@gmail.com> # Conflicts: # CMakeLists.txt
* usbd: Implement libusb passthrough * clang-format * only do kernel activities on non-windows * use variable to represent "fake" windows kernel driver --------- Co-authored-by: georgemoralis <giorgosmrls@gmail.com> Change-Id: I63be75d7d7289c367c995e2878539b400ee93502
* usbd: Implement libusb passthrough * clang-format * only do kernel activities on non-windows * use variable to represent "fake" windows kernel driver --------- Co-authored-by: georgemoralis <giorgosmrls@gmail.com> Change-Id: I63be75d7d7289c367c995e2878539b400ee93502
* usbd: Implement libusb passthrough * clang-format * only do kernel activities on non-windows * use variable to represent "fake" windows kernel driver --------- Co-authored-by: georgemoralis <giorgosmrls@gmail.com>





Re-opening pull request that I had previously opened on accident to implement libusb passthrough for the USBD library.
It appears that the free bsd build that orbis os is based off of used libusb for it's usb transactions (seen here), so we can use libusb as a submodule, and pass on all functions and parameters directly to libusb.
I can't take full credit for this code, many thanks go to Osyotr in the discord server who posted this code stub, I just needed to add the submodule.
The only major differences from the linked code stub are that I return the return value from libusb if the return code is > 0 (for methods where a return value > 0 is expected), and in the sceUsbdClaimInterface method, I check to see if a kernel driver is active before claiming the interface (required on linux and macos before performing device transactions)
I have tested this as working for Skylanders Trap Team, Skylanders Superchargers and Skylanders Imaginators on MacOS - would like some help testing more usb passthrough games (Lego Dimensions or Disney Infinity) as well as any users on Windows/Linux. Just an FYI that users on Windows will need to install winUSB as a driver for their chosen passthrough device, which can be done using Zadig