Main Site Documentation

Task Tracker - Support for USB HID Devices


#1

I just posted Support for USB HID Devices on Task Tracker. Feel free to discuss and make suggestions here.


#2

@ PiWi - What sort of API would you expect a HID class to have?


#3

Hi John, thank you for taking the time for this.

API … hm … connect / disconnect events as well as data received event if possible of course. A method to send data. I think a byte / char array / buffer to receive and send would suffice.

To be honest, basically what is avail in .Net, if can be done. I’d already be happy to communicate to a USB HID device at all, without need to know all the internals of a USB HID.

I hope this answers your question.

Cheers,

Peter

Oh btw, I got it working on Cerbuino(Bee or Net) but executing the same code on a Raptor no UnknownDeviceConnectedEvent was fired, I didn’t check for other events but I’ll try again and let you know.


#4

@ PiWi - What would you get from this class that raw device does not provide you? The only thing your list has that it does not is a DataReceived event.


#5

@ John - I recon .netmf is not good at timing stuff, I’d hoped that this driver was kind of implemented in native code so real timing does not need to be of my concern.

But if that is the only thing what is not in, then could you provide me with some links or examples how to implement this rawdevice since from there on I’m a noob.

Receiving events and processing data is one thing, that I can handle, making it all be myself is something I am not that familiar with … so therefore the request …

But I’m easily convinced of a more suitable way …


#6

@ PiWi - For the DataReceived event, that might not make too much sense since USB is based around the host polling the client. For devices like mice and keyboards where we provide a class and events, we sit in a thread and poll the device for information then format it and send it on to you. For a generalized HID device, I do not know if a DataReceived event would work since it may not apply to every device and it would possibly be hard to keep generic.

For use of RawDevice, we will be posting a CodeShare entry and adding a little description for raw device to the USB Host document soon. There were some changes made to make it easier to derive from and work with RawDevice that are coming shortly in the next SDK that we are waiting on.

Briefly:

You’ll want to potentially read the device and configuration descriptors from your device and then make a call (or more) to SendSetupPacket to configure the device. After that, call OpenPipe with the desired endpoint (a list of which are returned in the descriptors). OpenPipe will return a Pipe object with a Transfer method that you can use to read and write from the device based on whether the endpoint it was created with is a read or write endpoint.

The specific format of the setup packet and the data sent and received from transfer depends on the specific device you connect.


#7

Thank you John for the answer that helped a bit, I guess.

I’ll probably wait for that codeshare entry coming with the new SDK.

One more question, I’m trying to get it to work on a raptor but have to stay in plain netmf. I know it can be done, but somehow I’m running into the same over and over again.

I’m connecting the USB HID to socket 7 (is a lucky number after all) and can’t get the events to get fired … none of them …

You can close the suggestion with the comment that it will be further explained in the dox with code example in the upcoming SDK.

Thanks again for your time.


#8

@ PiWi - We’re happy to help. If you create a new thread for the lack of event issue, we can help you with that there.


#9

Support for USB HID Devices was updated.

Status went from Proposed to Closed.