On 10/19/2012 08:08 PM, Scott Talbert wrote:
> The solution ended up being a bit different than what is done for usbnet. 
> Unfortunately, zwave-hid does not actually provide any way (that I could 
> find) to get the size of the config in advance.  So, we have to read it 
> twice - once to figure out how long it is, and then once to actually save 
> it.  Additionally, once the end of the config has been read, we have to 
> keep reading until we get to the end of the region.  The result of this is 
> that it takes a while to read the config.  Also, the callback output ends 
> up being a bit weird (since we don't actually know how many bytes we're 
> going to read), but I at least tried to provide an indication that we're 
> doing something.
> 
> Let me know what you think.

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!



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.

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?

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?

-- 
Phil Dibowitz                             p...@ipom.com
Open Source software and tech docs        Insanity Palace of Metallica
http://www.phildev.net/                   http://www.ipom.com/

"Be who you are and say what you feel, because those who mind don't matter
 and those who matter don't mind."
 - Dr. Seuss


Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
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

Reply via email to