<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">On Aug 31, 2015, at 9:01 AM, Rob Groner <<a href="mailto:rgroner@RTD.com" class="">rgroner@RTD.com</a>> wrote:<br class=""><div><blockquote type="cite" class=""><br class="Apple-interchange-newline"><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">iSerialNumber does not need to be unique per device - it is not very many bits wide.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I’m pretty sure I don’t *<b class="">need</b>* iSerialNumber…I mean, I could just remove it from the report descriptor altogether.  But since it is available to give, and we are writing each board’s serial number into flash as part of the micro-controller programming (we aren’t talking a staggering number of boards per year here), I figured I should try to send the actual serial number.</span></div></div></div></blockquote><div><br class=""></div>Right, I was trying to make clear that iSerialNumber can be 3 for every board (or 42 or whatever) even though every board returns a unique string when you request the string indexed by iSerialNumber.<br class=""><blockquote type="cite" class=""><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></div><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">NUT and other tools match against the string returned from the "get string descriptor" request (not iSerialNumber itself - the string indexed by it) and the procedure for modifying that is going to be specific to each USB device controller.<o:p class=""></o:p></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">By this do you mean…just simply send the serial number as data (like all other report values) instead of as a string pointer index, and interpret the bytes on the NUT end?  I have already written an RTD UPS driver for NUT, so adding a custom function isn’t a problem.  I was trying to search through other drivers to find an example of where they passed a string without using the string index method.</span></div></div></div></blockquote><div><br class=""></div><div>No, just as a variable string descriptor.</div><div><br class=""></div><blockquote type="cite" class=""><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></div><div style="margin: 0in 0in 0.0001pt 0.5in; font-size: 12pt; font-family: 'Times New Roman', serif;" class="">like PICs make this harder, but there is a C __attribute__ or something that you should be able to use). Otherwise, does your USB framework allow callbacks for arbitrary requests?<span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><o:p class=""></o:p></span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></div><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">Hmm…I’ll admit, I’ve never used __attribute__, and I honestly don’t know enough about how Microchip PIC32’s handle the USB framework to know.  I’ll have to research both of those.<o:p class=""></o:p></span></div></div></div></blockquote><div class=""><div class="WordSection1" style="page: WordSection1; orphans: auto; text-align: start; text-indent: 0px; widows: auto;"><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: 'Times New Roman', serif; font-size: 12pt; margin: 0in 0in 0.0001pt;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""> </span></div><div style="margin: 0in 0in 0.0001pt;" class=""><font face="Calibri, sans-serif" class=""><span style="font-size: 15px;" class="">And I've never used a PIC32 :-) If it has a flat 32-bit address space, then forget what I said about __attribute__. It would only be for the smaller PICs that use different instructions (and different address spaces) for code and data.</span></font></div><div style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; font-family: 'Times New Roman', serif; font-size: 12pt; margin: 0in 0in 0.0001pt;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class=""><br class=""></span></div></div></div><blockquote type="cite" class=""><div class=""><div class="WordSection1" style="page: WordSection1; font-family: Helvetica; font-size: 14px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div style="margin: 0in 0in 0.0001pt; font-size: 12pt; font-family: 'Times New Roman', serif;" class=""><span style="font-size: 11pt; font-family: Calibri, sans-serif; color: rgb(31, 73, 125);" class="">I wondered if I could somehow set the pointer for the iSerialNumber string index to the address of it in memory (in other words, load it from Flash into a global var, and then use that address when the iSerialNumber pointer is requested), but from how it is implemented, I couldn’t figure it out.  I’ll look again.</span></div></div></div></blockquote><div><br class=""></div><div><a href="http://ww1.microchip.com/downloads/en/AppNotes/01176A.pdf" class="">http://ww1.microchip.com/downloads/en/AppNotes/01176A.pdf</a> has code (Example 6) that allows you to specify a custom function to generate the string descriptor responses. It looks like it should be fairly simple to special-case the serial number descriptor.</div><div><br class=""></div></div><div class="">
<span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px;"><div class="">-- </div><div class="">Charles Lepple</div><div class="">clepple@gmail</div><div class=""><br class=""></div></span><br class="Apple-interchange-newline">

</div>
<br class=""></body></html>