Teensy RawHID Device with hidapi library from desktop host?

Status
Not open for further replies.

quangdog

New member
I have a device that was created using Teensy RawHID that I need to communicate with using a desktop application I'm writing. As far as I can tell, this is not behaving as a typical HID device, as my tools are unable to send data to / read data from it correctly.

I'm using the hidapi library from Signal 11 in my desktop app to enumerate, connect to, and communicate with HID devices from the host computer. I'm able to connect to and communicate with other HID devices, just not this one that was implemented with Teensy's RawHID.

So, 2 questions:

1) Should I be able to communicate with a Teensy RawHID device using a standard HID library such as hidapi (https://github.com/signal11/hidapi)?

2) Without access to the source that was put onto the device I'm connecting to, where should I look to learn how to debug this connection?

Thanks!
 
1) Should I be able to communicate with a Teensy RawHID device using a standard HID library such as hidapi (https://github.com/signal11/hidapi)?

Yes, that should be able to communicate. Or you could use the C code here:

https://www.pjrc.com/teensy/rawhid.html


2) Without access to the source that was put onto the device I'm connecting to, where should I look to learn how to debug this connection?

RawHID merely sends and receives 64 byte packets. If you don't know what those 64 bytes actually mean, you're going to have quite a challenge actually using them, even if you are able to successfully send and receive the packets.

Of course, you could work first on just being able to get the packets. The best way would be programming another Teensy with the known example code, then working with hidapi or the examples PC side code to talk with the known-code Teensy. Maybe once you've got experience with being able to actually communicate packets, perhaps you'll manage to figure out how to use the data from that other project?
 
Hi Paul, thanks for the quick response.

I am familiar with HID, and I designed the communication protocol (i.e., the layout for the HID reports that this device is using). The hardware engineer we have working on this is less familiar with HID, and I suspect that something is not set up correctly in the Teensy library on his side.

My difficulty is that when I attempt to call hid_write() from the host, my side of the connection locks up, apparently waiting for the response from the Teensy device, and I'm trying to assist the hardware engineer to figure out why.

To be clear: I can get the device to enumerate, I can connect to it and read the VID, PID, Product Name, etc... it just locks up my side of the connection when I try to send a report to it.
 
it just locks up my side of the connection when I try to send a report to it.

On the very old Raw HID page, you can find a sample program which works with the examples on Teensy. It prints packets as they arrive. If you type keystrokes on your PC to that window, it sends them in packets to Teensy. No lockups. I know that code probably isn't quite what you need, but maybe a working sample that doesn't lock up can at least help?
 
Status
Not open for further replies.
Back
Top