# HG changeset patch # User Mychaela Falconia # Date 1604608675 0 # Node ID c79aaed75bd89c9344875257a0414b63c80b3bb0 # Parent 5dd748850f2b9567422b594c83c72186211b9c0f compile-fc-batt: allow possible third field in source lines Battery tables maintained in the fc-battery-conf repository will now have a third field added, defining thresholds for the battery bars icon, and there will be a new utility to compile them into the new /etc/batterytab2 file read by the FC Tourmaline version of our FCHG driver. For backward compatibility with the original Magnetite version of FCHG, compile-fc-batt remains the tool for compiling the original /etc/batterytab file format, and it needs to ignore the newly added third field in battery table sources. diff -r 5dd748850f2b -r c79aaed75bd8 ffstools/newcomp/compile-fc-batt.c --- a/ffstools/newcomp/compile-fc-batt.c Thu Nov 05 19:30:14 2020 +0000 +++ b/ffstools/newcomp/compile-fc-batt.c Thu Nov 05 20:37:55 2020 +0000 @@ -1,7 +1,7 @@ /* - * This utility compiles a table of battery thresholds for the new FreeCalypso - * battery management code from ASCII source into the binary form suitable - * for uploading into /etc/batterytab on a FreeCalypso device. + * This utility compiles a table of battery thresholds for the 2017-12 version + * of FreeCalypso battery management code from ASCII source into the binary + * form suitable for uploading into /etc/batterytab on a FreeCalypso device. */ #include @@ -43,10 +43,9 @@ percent = strtoul(cp, 0, 10); while (isdigit(*cp)) cp++; - while (isspace(*cp)) - cp++; - if (*cp != '\0' && *cp != '#') + if (*cp && !isspace(*cp)) goto inv; + /* ignore possible third field added in 2020-11 for bars threshold */ if (mv > 0xFFFF) { fprintf(stderr, "%s line %d: the millivolt value is invalid\n", infname, lineno);