1
votes

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.

2
Do you mean "another USB controller" as in another mainboard/computer, or "another USB device"?Vladislav Zorov
Hum I mean : another USB Joystick attached to the same computer ;)alex
Wonderful ! Slimdx resolves my 3 months old nightmares !alex
Ok, posting as an answer, so you can click "accept" :) Didn't expect this would solve your issue :DVladislav Zorov

2 Answers

0
votes

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

0
votes

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