Keep undecoded firmware / serial info from libdivecomputer

This needs to become a string in libdivecomputer - but for now let's just
keep the integers so we can parse it elsewhere when we know which model it
is - the generic parsing into a string is completely bogus and needs to go.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-12-27 08:27:16 -08:00
parent 1c65b2f3c4
commit 9f95f3ce18
2 changed files with 4 additions and 11 deletions

View file

@ -733,16 +733,8 @@ static void event_cb(dc_device_t *device, dc_event_type_t event, const void *dat
/* really, serial and firmware version are NOT numbers. We'll try to save them here
* in something that might work, but this really needs to be handled with the
* DC_FIELD_STRING interface instead */
if (serial != 0) {
snprintf(buffer, sizeof(buffer), "%04u-%04u", serial / 10000, serial % 10000);
devdata->serial = strdup(buffer);
fprintf(stderr, "libdc devinfo serial nr converted to %s\n", devdata->serial);
}
if (devinfo->firmware != 0) {
snprintf(buffer, sizeof(buffer), "%02u.%02u", devinfo->firmware / 100, devinfo->firmware % 100);
devdata->firmware = strdup(buffer);
fprintf(stderr, "libdc devinfo firmware version converted to %s\n", devdata->firmware);
}
devdata->libdc_serial = devinfo->serial;
devdata->libdc_firmware = devinfo->firmware;
break;
case DC_EVENT_CLOCK:
dev_info(devdata, translate("gettextFromC", "Event: systime=%" PRId64 ", devtime=%u\n"),

View file

@ -19,7 +19,8 @@ typedef struct device_data_t
{
dc_descriptor_t *descriptor;
const char *vendor, *product, *devname;
const char *model, *serial, *firmware;
const char *model;
uint32_t libdc_firmware, libdc_serial;
uint32_t deviceid, diveid;
dc_device_t *device;
dc_context_t *context;