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

nsyshid: Experimental libusb build #903

Closed
wants to merge 5 commits into from

Conversation

deReeperJosh
Copy link
Contributor

Just creating this for visibility - and for any interested parties who may know more than I do. I am trying to make the nsyshid library cross platform, so that it can be used on MacOS and Linux. This is step 1 in trying to port some code that I have worked on to bring Emulated USB devices such as the Skylanders Portal/Infinity Base/Dimensions Toypad. LibUSB requires some more information in order to actually be able to send such requests though, such as bmRequest/bmRequestType, endpoint and some other bits of data. If anyone has some ideas about where to obtain this info it would be much appreciated!

I would also like to note that I haven't implemented libusb prior to attempting this - and I am currently in the process of moving overseas so haven't got access to my Wii U at the time of opening this PR, so this may take a while.

@TheRealWario
Copy link

Does this bear any relevance to my post? #902

@deReeperJosh
Copy link
Contributor Author

It doesn't, but other libusb implementations (RPCS3 and Dolphin) have working Trap Team audio transfers, so the speakers should work on Cemu after this :)

target_include_directories(CemuCafe PUBLIC
"../"
${LIBUSB_INCLUDE_DIR}
)
Copy link
Contributor

@Tachi107 Tachi107 Jul 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please avoid manually adding a list of include dirs and libraries like these, and use imported targets instead. I'm not sure how to patch vcpkg dependencies to add imported targets when they are not already provided, but you could always submit a patch to https://github.com/microsoft/vcpkg/tree/master/ports/libusb.

Edit: the imported target should probably be named libusb::usb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just going off of the usage for the libusb vcpkg, not sure if I would actually know what needs to change to submit a package there either but I will look in to it

@LuismaSP89
Copy link

LuismaSP89 commented Jul 17, 2023

Sorry, but would this libusb eventually bring us the possibility to use real wiimote support on the emulator? Just like the bluetooth passthrough on dolphin, were you can use the original bluetooth controller of the Wii instead of emulating it. In dolphin also uses the libusb (Replacing the driver with Zadig USB driver)

@deReeperJosh
Copy link
Contributor Author

In theory yes, but I wouldn't be able to implement that functionality myself, not yet anyway

@ssievert42
Copy link
Contributor

Hey, I opened #946 yesterday (have been working on and off on this and had it kind of working since may 2023), but totally missed this PR 😅
Completely emulated devices sound like a great idea!
In #946, I've got the real Lego Dimensions portal to work reliably on linux :)
An unsolved issue are still controls transfers, but at least the Lego Dimensions portal seems to not really need them.
In theory, my implementation should be cross platform, but I've got no way to test on Windows or macOS.

My suggestion would be, that I'd restructure #946 a bit to allow implementing virtual devices, and once that is merged, you could then use that as a base for fancy emulated devices.
Do you think that requiring a device to have the following functionality would be enough?

  • get vendor and product id
  • get max packet sizes for RX and TX
  • try to write a block of data to the device and return the bytes written
  • try to read a block of data into a buffer and return the bytes read
  • get descriptors as implemented in export_HIDGetDescriptor
  • try to do control transfers with some of the arguments of _hidSetReportSync

@deReeperJosh
Copy link
Contributor Author

Oh that's great! I actually haven't been able to touch this work since I opened the PR, so honestly just do whatever works, I think creating some sort of Device class, that can be extended to be either a USB device or an Emulated Device would be ideal, but I will leave that up to you! And I will close off this PR, and collaborate with you as needed on your PR

@deReeperJosh deReeperJosh deleted the libusb branch September 19, 2023 19:45
@deReeperJosh deReeperJosh restored the libusb branch September 19, 2023 19:45
@deReeperJosh deReeperJosh deleted the libusb branch September 19, 2023 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants