[Nut-upsdev] Developing the UPS side of the UPS-NUT equation (via usbhid)

Rob Groner rgroner at RTD.com
Sat Mar 8 14:40:47 UTC 2014


Thank you!  It is nice to have some confirmation that I'm on the right track.  

The tutorial was pretty helpful, though it deferred some of the definitions to referencing the HID documents.  I don't really have any questions about that, but I'll post the link for others in case they come upon this thread later.

http://eleccelerator.com/tutorial-about-usb-hid-report-descriptors/

I found the HID report descriptor that the Microchip controller assembles in code, and they did a good job of documenting each line, so I'm going to do some experimentation with putting together my own descriptor from that.  I'm still a little foggy on the proper use of collections, but the top level HID docs at usb.org are turning out to be almost understandable now.

http://www.usb.org/developers/devclass_docs/HID1_11.pdf

I think I have the general idea now, which is comforting because I was completely dumbfounded just a few days ago.  I'll post more specific questions as they come.  Thanks again!

Rob

-----Original Message-----
From: Charles Lepple [mailto:clepple at gmail.com] 
Sent: Friday, March 07, 2014 7:04 PM
To: Rob Groner
Cc: nut-upsdev at lists.alioth.debian.org
Subject: Re: [Nut-upsdev] Developing the UPS side of the UPS-NUT equation (via usbhid)

On Mar 7, 2014, at 11:24 AM, Rob Groner wrote:

> Charles,
> 
> Thank you so much for the information.  I'm trying to digest it along with the other docs I have, the example code from Microchip, and a USB HID tutorial I found online.

I realize that some of the descriptions can be a bit vague, so if you want to post a link to the HID tutorial, I can try to describe what is going on there.

> So, if I understand correctly....  When the device first connects, it sends a huge dump of data

(the HID Report Descriptor)

> (which the usbhid driver shows when you use the debug option) which fully describes the data it is capable of sending.

Correct. At some point, the usbhid-ups driver starts asking the UPS for reports corresponding to the variables it needs, but that initial traffic is from reading the HID Report Descriptor, then looking up the report IDs from the parsed descriptor.

> The usage id's, pages, etc use values from the USBHID spec, but the actual data can be defined as needed by the device (in terms of width and ranges), and then the device assigns an arbitrary (but I'm assuming unique) report ID to the description so that when it needs to send the data, it can do so simply with a Report ID and the described data.  


That's it.

-- 
Charles Lepple
clepple at gmail






More information about the Nut-upsdev mailing list