-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
usbd: Implement libusb passthrough #2271
base: main
Are you sure you want to change the base?
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
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