<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
<br>
Charles Lepple wrote:
<blockquote cite="mid:EED4288C-70C6-4449-B4B3-01F291EDC1A5@ghz.cc"
type="cite">
<div>
<div>On Jan 8, 2010, at 7:29 AM, Tim Nicholson wrote:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<div bgcolor="#ffffff" text="#000000"> Charles Lepple wrote:
<blockquote cite="mid:14C64C17-A8DE-433D-862B-437C80E89C0F@ghz.cc"
type="cite">On Jan 8, 2010, at 6:16 AM, Tim Nicholson wrote: <br>
<br>
<blockquote type="cite">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. <br>
</blockquote>
<br>
Your device's HID report descriptor does not specify any report IDs, so
the paths don't matter. <br>
<br>
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? <br>
<br>
</blockquote>
Charles, <br>
<br>
Thanks so much for replying so quickly.<br>
<br>
<font face="sans-serif">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.<br>
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?<br>
</font></div>
</blockquote>
</div>
<br>
<div>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?</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
<div><br>
</div>
<div>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.</div>
</blockquote>
<br>
Thanks,<br>
<br>
The Microchip URL where the download can be found is
<a class="moz-txt-link-freetext" href="http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2651¶m=en534494">http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2651&param=en534494</a>.
(The framework comes in the form of a zip file which, unfortunately, is
pretty large even by modern standards).<br>
<br>
I have not made any changes to the demo source code as yet, as I was
just trying to interface with the standard demo software as a first
step. My final application will not be much more complex as all I
need to do is detect some key presses and read the
ADC on the PIC. The ability to read and write single 64-byte buffers is
all I am looking for. I will have a look at libusb, to see if I can
make any sense of that. My biggest problem is I am very new to USB and
I am finding all the terminology difficult to get my head around. All
of the Microchip texts and examples are designed for Windows developers
which is fine except my final application will be running on embedded
Linux and I have not really had anything to do with Windows software
development since the mid 90's. I have tried looking at the USB
specifications but trying to tie it altogether is not proving very easy
- I am suffering from information overload!<br>
<br>
Any pointers would be much appreciated. I just need to understand what
functions I need to call to establish a connection and transfer data to
and fro.<br>
<br>
Tim<br>
</body>
</html>