From 3927be9ced68b01b3f16601dd975c4363738aaa6 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 6 Mar 2014 08:35:15 +0100 Subject: [PATCH] Fix the decoding of the serial number. The serial number is stored as a plain 32bit integer, and the device shows the hexadecimal representation. Because a BCD encoding can only represent the lower digits (0-9) of a hexadecimal number, the upper digits (A-F) got mangled. Reported-By: Nick Shore --- src/diverite_nitekq.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/diverite_nitekq.c b/src/diverite_nitekq.c index 067296d..30692c6 100644 --- a/src/diverite_nitekq.c +++ b/src/diverite_nitekq.c @@ -276,11 +276,7 @@ diverite_nitekq_device_dump (dc_device_t *abstract, dc_buffer_t *buffer) dc_event_devinfo_t devinfo; devinfo.model = 0; devinfo.firmware = 0; - devinfo.serial = 0; - for (unsigned int i = 0; i < 4; ++i) { - devinfo.serial *= 100; - devinfo.serial += bcd2dec (device->version[0x0A + i]); - } + devinfo.serial = array_uint32_be (device->version + 0x0A); device_event_emit (abstract, DC_EVENT_DEVINFO, &devinfo); // Send the upload request. It's not clear whether this request is