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 <support@mac-dive.com>
This commit is contained in:
Jef Driesen 2014-03-06 08:35:15 +01:00
parent 0e11bad6c0
commit 3927be9ced

View File

@ -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