0

I may not even know enough about interacting with HIDs to ask a good question, but here's my best shot so far. I am using C# and am on Windows currently.

I have been researching how to interact with a game controller like a PlayStation 4 or PlayStation 5 controller. I would like to be able to determine when a button is pressed, how far a trigger is pushed down, and any other input a user could perform. The other part I would like to find out how to do is provide input to the controller. This could be something like telling the controller to rumble, or it could tell the PlayStation 5 controller to adjust the tension in its triggers, which is a new feature to that controller.

I have gotten far enough to where I think I can find the device, connect to it, and then start receiving reports with data from the controller. I also see ways to write data to the controller, but I have not tried that yet.

The main barrier I am running into is that I do not know how to parse that data that I am getting back. I am getting 63 bytes of data, but don't know what any of it is supposed to mean. Likewise, I don't know what format to use when sending data to the controller.

I know I can monitor that 63 bytes to see what changes when in press buttons on the controller, but I'm wondering if there is a good way for me to get this information without trial and error. I also don't know of a similar thing that I can do to figure out how to provide data to the controller myself.

Is there a way to get this information from the device itself, or would this information need to be provided by the controller manufacturer?

Brett Lesnau
  • 208
  • 3
  • 8
  • Github is your bigger friend https://github.com/Mr-Kittyhawk/dualsense-dotnet – Caspar Kleijne Jan 12 '21 at 21:12
  • Geez. I don't know how I missed that. The first thing I did was search for DualSense and C#. Thanks! It does look like it's missing the functionality that I want, but it's a start. – Brett Lesnau Jan 12 '21 at 21:29
  • Also on Github https://github.com/abend0c1/hidrdd will decode the HID report descriptor - which you can obtain by capturing a Wireshark trace or using libusb to retrieve. This will tell you what the format of each report is. – aja Jan 13 '21 at 04:56
  • @aja Thank you. I did not know about hidrdd. I have not tried it enough yet, but it seems like it may only work for descriptors that have been officially published. I may also just not know the terminology well enough for these devices, but that repo mentions report descriptors, which I think may only apply to reading input from a USB device and may not include information for how to write data to the device itself. – Brett Lesnau Jan 13 '21 at 15:35
  • Brett, the HID report descriptors define the structure of input reports (from the device to the host), output reports (from the host to the device), and feature reports (which are bidirectional). Hidrdd knows about all the usages published by usb.org but lets you define your own vendor-specific usages if you wish. – aja Jan 13 '21 at 23:49

0 Answers0