On Tue, Feb 16, 2010 at 11:52 PM, Jim Paris <[email protected]> wrote: > Marek Vavruša wrote: >> Hi folks, >> >> for anyone interested - I have started a library, which is able to >> interact with USB subsystem over TCP/IP. > ... >> So if you have thoughts or are brave enough to try it, please let me >> know. I'll be glad for any feedback or bugreports. > > Interesting... I don't have an immediate use for this, but I've come > across cases in the past where it would have been useful so I'll be > sure to keep it in mind. > > I was glancing through the source to see how endian issues were > handled, and it seems like they're not -- everything looks fine if > they're the same, but it looks like it wouldn't work with a > little-endian server and a big-endian client. Is that correct?
Correct. I'm in phase of bugfixing and creating usable documentation, so I'm going to implement htons conversions as soon as I can. Thanks for pointing this out! > > I also noticed the error below; 16-bit values would be truncated to > 8-bit (although I guess this isn't used by the current code): Thanks for the patch, applied! I must have been really sleepy at a time :-) > > -jim > > diff --git a/src/proto/protocol.cpp b/src/proto/protocol.cpp > index e0ade66..c44450b 100644 > --- a/src/proto/protocol.cpp > +++ b/src/proto/protocol.cpp > @@ -67,7 +67,8 @@ Block& Block::addNumeric(uint8_t type, uint8_t len, > uint32_t val) > pushPacked(len); > > // Cast to ensure correct data on both Big and Little-Endian hosts > - uint8_t val8 = val, val16 = val; > + uint8_t val8 = val; > + uint16_t val16 = val; > if(len == sizeof(uint32_t)) append((const char*) &val, sizeof(uint32_t)); > if(len == sizeof(uint16_t)) append((const char*) &val16, sizeof(uint16_t)); > if(len == sizeof(uint8_t)) append((const char*) &val8, sizeof(uint8_t)); > > Just a out of interest, interrupt transfers are another untested part of the code. Anyone capable of testing it or could point me to a device using it? Thanks, Marek Vavrusa -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
