[Nut-upsuser] Update to 2.2.1-2

Arjen de Korte nut+users at de-korte.org
Mon Feb 25 20:44:43 UTC 2008


BREZINA Oti wrote:

> I think - mean I not sure, but ... :)
> 
> from log it seems that problem apear since upgrade 2.2.0-2.1 to 2.2.1-1.
> Later I update to 2.2.1-2 later, but this not help :)
> 
> 2008-02-03 13:59:48 upgrade nut 2.2.0-2.1 2.2.1-1
> 2008-02-22 00:21:46 upgrade nut 2.2.1-1 2.2.1-2

OK, I found the culprit. With USB, you can't have more than 300 reports,
which is listed in 'hidtypes.h' since the first version of this driver:

> #define MAX_REPORT		300		/* Including FEATURE, INPUT and OUTPUT	*/

Up to (and including) nut-2.2.0, the hidparser never cared about how
many reports it would extract from the report descriptor. It would
simply keep on allocating memory for new data elements. For instance,
while parsing the report descriptor from the logs you send, it came up
with no less than

> pDesc->nitems = 470

reports, which is more than the MAX_REPORT number that is allowed in
nut-2.2.1. I have not found out what exactly causes this behavior yet.
It could be duplicate or bogus reports for instance.

The good news is, that we can fix this relatively easy, by not
allocating the maximum number of reports we expect, but a good deal more
(600 for instance). Since the reports that we don't need, will be handed
back to the memory pool as soon as we know how many we have parsed (we
only know this, when ready), this shouldn't cause any problems.

I have submitted a patch for this in the SVN development trunk (r1334).
Thanks for your cooperation in solving this.

Best regards, Arjen



More information about the Nut-upsuser mailing list