[libhid-discuss] problems reading data

Charles Lepple clepple at ghz.cc
Fri Jan 8 13:14:17 UTC 2010


On Jan 8, 2010, at 7:29 AM, Tim Nicholson wrote:

> Charles Lepple wrote:
>>
>> On Jan 8, 2010, at 6:16 AM, Tim Nicholson wrote:
>>
>>> I am trying to write an interface in C so I can communicate with a  
>>> PIC chip via USB using libhid, but I do not understand how to use  
>>> the path information I am seeing to send and receive massages.
>>
>> Your device's HID report descriptor does not specify any report  
>> IDs, so the paths don't matter.
>>
>> However, there is a chance that the device is only expecting you to  
>> read and write to the interrupt endpoints (not the control  
>> endpoint). Is the source code for this device available online?
>>
> Charles,
>
> Thanks so much for replying so quickly.
>
> The code is part of the Microchip USB framework which can be  
> downloaded from the microchip website. It is the generic HID example  
> code for the low pin count development board which uses the  
> PIC18F14K50.
> Is there anything I can post that will help? I could email you the  
> source I used to compile the .hex if you wouldn't mind taking a look?

I could take a look after work. For the benefit of others searching  
the list in the future, can you post a direct link to the page on  
Microchip's site?

If you have made any significant changes to the source code, that  
would be useful to know - but if you are just reading and writing the  
64-byte buffers being sent in and out, then the exact data probably  
doesn't matter. That also means that libhid is probably overkill for  
what you are doing. There are a few key libusb functions which you  
might be interested in, and you can save yourself some trouble by just  
incorporating that into your code.

libhid is really for devices like uninterruptible power supplies,  
which provide a "tree" of values (hence the "path" for specifying a  
value of interest). In the case of an UPS, you would want to poll a  
few key values to determine whether to shut down the system, and the  
rest are just statistics which are harvested less frequently.

Also, if your target application is more like a specialized mouse or  
keyboard, you can adjust the HID descriptor to mimic a standard input  
device. Microchip used to provide virtual mouse firmware which  
basically moved the mouse cursor around when you plugged the device  
in. This use case also doesn't require libhid, since the OS input  
subsystem would handle the events the same way it would read from your  
primary mouse and keyboard.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/libhid-discuss/attachments/20100108/0367dd6d/attachment.htm>


More information about the libhid-discuss mailing list