Click here to Skip to main content
15,944,733 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
public void sendStartCMD()
            byte[] startCMD = new byte[8];
            startCMD[0] = 255;
            startCMD[1] = 0;
            startCMD[2] = 28;
            startCMD[3] = 20;
            startCMD[4] = 20;
            //tRepeat - High
            startCMD[5] = 0;
            //tRepeat - Low
            startCMD[6] = 0x01;
            startCMD[7] = 0xF4;
            //send the command

Hi, I am new to C# and HID USB communication.
I am having trouble with sending data.
I am trying with USBHIDDRIVER.dll. and I checked receiving data well.
However, When I try sending data with the function above, usbI.write()function always returns false.
When I checked with Beagle, there is no data out.

and also when I checked the function below, "NumberOfBytesWritten" has 0 after the function excuted.
Result = USBSharp.WriteFile(hidHandle, ref outputReportBuffer[0], outputReportBuffer.Length, ref NumberOfBytesWritten, 0);

How can I send data properly? Please let me know if there is something I am missing.

Thank you very much,
Updated 3-Sep-14 22:39pm
George Jonsson 4-Sep-14 8:10am    
You assume that everyone knows what kind of animal USBHIDDRIVER.dll is and I don't think you can count on that.
You can try to find a USB monitor software to see of anything is happening in the lower levels.

1 solution

You should check out your library documentation, in order to get additional info. If the documentation is not provided (or is poor) then you might inspect the library source code and try to understand the real problem (or replace the library function call with the underlying Winapi calls).
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900