1

I'm successfully receiving bytes from an USB device using a HID USB .net library. Here is a sample of my code :

        Dim ptr As IntPtr = USB.USB_Read()
        Dim buff As Byte() = New Byte(USB.USB_ReadLength() - 1) {}

        Marshal.Copy(ptr, buff, 0, buff.Length)
        textBox_Read.Text = BitConverter.ToString(buff)

And here is a sample of received data :

00-01-00-F0-00-00-00-80
00-00-00-F0-00-00-00-80

Or with another USB controller :

00-6D-6A-A8-72-B2-70-7B-7E-00-80-01-00-00-00
00-6D-6A-A8-72-B2-70-7B-7E-00-80-01-00-00-00
00-6D-6A-A8-72-B2-70-7B-7E-00-80-00-00-00-00
00-6D-6A-A8-72-B2-70-7B-7E-00-80-00-00-00-00

My question is : how can I know wich button is pressed ? Meaning : I just want my program to store the button pressed and do an action when pressed.

How can I interpret this data ?

Regards, Alexis.

alex
  • 39
  • 5

2 Answers2

0

This app talks to the PS5 Dual Sense controller using Device.Net

Christian Findlay
  • 6,770
  • 5
  • 51
  • 103
0

The information on how to interpret these is possibly proprietary.

If you target just this one device, you could just try different buttons and look for patterns in the bytes.

Your other option is to leave the interpretation of bytes and USB ports to the drivers and get your data from Windows and DirectX - e.g. Taking input from a joystick with C# .NET

Community
  • 1
  • 1
Vladislav Zorov
  • 2,998
  • 19
  • 32