Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
692 views
in Technique[技术] by (71.8m points)

C# and USB HID Devices

I'm looking for one of either 2 things

1 - A working example of code using Florian's library from: http://www.florian-leitner.de/index.php/2007/08/03/hid-usb-driver-library/

This seems to be one of the better (only???) C#/HID libraries but the author has gone MIA and I can't seem to get a code example to work. The code I have is:

{
    USBHIDDRIVER.USBInterface usb = new USBInterface(myvid,mypid);
    if (usb.Connect())
        MessageBox.Show(”connection!”);
    else
        MessageBox.Show(”FAIL”);

    usb.enableUsbBufferEvent(new System.EventHandler(myEventCacher));
    usb.startRead();
}

private void myEventCacher(object sender, EventArgs e)
{
    string content = e.ToString();
    MessageBox.Show(content);
}

The connection part works but the event proc is never fired. So I'd like to know if anyone has a working example of this library code with the event handler firing.

2 - If there is a better library for handling C#/HID interaction I'd like to hear about it.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...