On Sun, 21 Oct 2012, Phil Dibowitz wrote: > OK, so minor note, the output gets messed up switching between these two: > > Reading config: 99% 1664 KiBReading config: 99% 699 KiB > > and then: > Reading config: 99% 1664 KiBReading config: 99% 1664 > KiBSuccess!
Yeah, it gets weird because I'm calling ReadRegion twice with the same callback. I originally didn't have a callback in the first call to ReadRegion, but then it would sit there without showing any output for a couple of minutes, so I figured weird output is better than no output. > Also, this comment doesn't match the code: > > - len = pkt[0] - 4; > + len = pkt[0] - 5; // subtract both TCP (4) and UDP (2) headers > > 6 != 5. Yes, it is a little confusing because pkt[0] is (len - 1), so it is really: len = pkt[0] + 1 - 6. Maybe I can comment better about that. > Also, I don't quite understand this comment: > > + // For zwave-hid remotes, need to read the config once to get the size > + // For usbnet we do this in UpdateConfig, but for hid it takes too > long > > You need to do it to read, it, what's that got to do with update? Yeah, that was a brain fart. It should read GetIdentity not UpdateConfig. I'll correct that. > On a more general note - and I only took a cursory look at the code, so > maybe I'm missing something... > > but ReadRegion will tell you the size, and ReadFlash just calls ReadRegion and > expects a size. > > We only have to read twice because we want to call ReadFlash to keep the call > the same between zwave and non-zwave, it seems (and MAN it's been a long time > since I looked at this code), that we could just call ReadRegion in the case > of zwave (which we know in read_config_from_remote(), and save a call? ReadRegion will tell you the size, but we need to know the size so we can allocate memory to store the region. So, we have to read the config once to get the size, allocate memory to store it, then read it again and actually store it. Scott ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_sfd2d_oct _______________________________________________ concordance-devel mailing list concordance-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/concordance-devel