summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-18 00:33:03 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-18 00:33:03 -0700
commit0773172f66ef3cd73a88e3297c8b5ae28cfe2a8f (patch)
treef0afadcacdb22dfe4781cd9891a95c302edcfcb6 /libdivecomputer.c
parent87e380c7a28b467705b470323275db3812e0fa90 (diff)
parent29b242c70349cbd67aacc3e4f1206630d22c54eb (diff)
downloadsubsurface-0773172f66ef3cd73a88e3297c8b5ae28cfe2a8f.tar.gz
Merge branch 'qtHelper'
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c19
1 files changed, 6 insertions, 13 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 6397018a3..2638376b8 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -578,36 +578,29 @@ static unsigned int undo_libdivecomputer_suunto_nr_changes(unsigned int serial)
static unsigned int fixup_suunto_versions(device_data_t *devdata, const dc_event_devinfo_t *devinfo)
{
- struct device_info *info;
unsigned int serial = devinfo->serial;
+ char serial_nr[13] = "";
+ char firmware[13] = "";
first_temp_is_air = 1;
serial = undo_libdivecomputer_suunto_nr_changes(serial);
- info = create_device_info(devdata->model, devdata->deviceid);
- if (!info)
- return serial;
-
- if (!info->serial_nr && serial) {
- char serial_nr[13];
-
+ if (serial) {
snprintf(serial_nr, sizeof(serial_nr), "%02d%02d%02d%02d",
(devinfo->serial >> 24) & 0xff,
(devinfo->serial >> 16) & 0xff,
(devinfo->serial >> 8) & 0xff,
(devinfo->serial >> 0) & 0xff);
- info->serial_nr = strdup(serial_nr);
}
-
- if (!info->firmware && devinfo->firmware) {
- char firmware[13];
+ if (devinfo->firmware) {
snprintf(firmware, sizeof(firmware), "%d.%d.%d",
(devinfo->firmware >> 16) & 0xff,
(devinfo->firmware >> 8) & 0xff,
(devinfo->firmware >> 0) & 0xff);
- info->firmware = strdup(firmware);
}
+ create_device_node(devdata->model, devdata->deviceid, serial_nr, firmware, "");
+
return serial;
}