From: folkert <fo...@va...> - 2013-04-24 15:46:11
|
> > The code of the (original) cleware c++ library does: > > > > int strInc = (s[1] == 0) ? 2 : 1 ; > > for ( ; *s ; s+=strInc) { > > // unicode byte 2 == 0 > > if (*s >= '0' && *s <= '9') > > SerNum = > > SerNum * 16 + *s - '0' ; > > else if (*s >= 'A' && *s <= 'F') > > SerNum = > > SerNum * 16 + *s - 'A' + 10 ; > > } > > > > So I think that some use plain ascii while others may use UTF-16 (with > > high byte set to 0x00). > > You should use the wide character functions. HIDAPI will give you a > wchar_t, with which you could use something like wcstol(). Yes. This was an example of how things were done on Linux to show that the device might return utf-16. > I'm less interested in what the PC-side does than what the firmware > does. Can you send your string descriptor (as a fragment of your firmware)? Hope I understood you but on the Mac that's a 0-bytes string and on Linux I receive: 30 30 30 31 30 36 41 00 00 00 00 00 30 30 30 31 37 35 43 00 00 00 00 00 30 30 30 32 33 44 39 00 00 00 00 00 these are the first 16 bytes in the buffer as returned by the HIDIOCGSTRING ioctl executed. Unfortunately I don't have access to the source code of the devices themselves. > Have you tried putting a normal string for the serial number in the > firmware (like hard-coding to "ASDF") and seeing if that makes it > through? I'm not working for Cleware so I don't have access to what is needed for that. > Are you able to see serial numbers from other devices? But that is definately something I can answer: yes, on both macs on which tests took place (using the testtool from hidapi) we saw serial numbers from other devices. Folkert van Heusden -- MultiTail na wan makriki wrokosani fu tan luku den logfile nanga san den commando spiti puru. Piki puru spesrutu sani, wroko nanga difrenti kroru, tya kon makandra, nanga wan lo moro. http://www.vanheusden.com/multitail/ ---------------------------------------------------------------------- Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com |