From ff15b865b2e35d38f0ee394c3a0d0218a763d5af Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Tue, 12 Jul 2016 22:16:21 +0200 Subject: [PATCH] Fix the decoding of the OSTC4 firmware version. The OSTC4 firmware version uses four digits for the firmware version (X.Y.Z.Beta), while all other hwOS models use two digits (X.Y). To preserve backwards compatibility with the existing two byte data format, the OSTC4 firmware version is packed into a 16 bit integer as follows: XXXX XYYY YYZZ ZZZB and stored with little endian byte order. --- src/hw_ostc3.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/hw_ostc3.c b/src/hw_ostc3.c index 0ed1874..2f88bf0 100644 --- a/src/hw_ostc3.c +++ b/src/hw_ostc3.c @@ -595,7 +595,11 @@ hw_ostc3_device_foreach (dc_device_t *abstract, dc_dive_callback_t callback, voi // Emit a device info event. dc_event_devinfo_t devinfo; - devinfo.firmware = array_uint16_be (id + 2); + if (device->hardware == OSTC4) { + devinfo.firmware = array_uint16_le (id + 2); + } else { + devinfo.firmware = array_uint16_be (id + 2); + } devinfo.serial = array_uint16_le (id + 0); if (device->hardware != UNKNOWN) { devinfo.model = device->hardware;