smart_device: report V1 device firmware in simplified form

The different ways the firmware version is reported by liquidctl and CAM
causes some confusion, of at least surprise; CAM nowadays uses a
simplified 2-digit form for the Smart Device V1 (and, presumably, the
Grid+ V3).
This commit is contained in:
Jonas Malaco 2022-05-30 11:05:59 -03:00
parent 6654def659
commit 344ce6b7b5
5 changed files with 10 additions and 6 deletions

View File

@ -16,7 +16,7 @@ Device #3: NZXT Kraken X (X42, X52, X62 or X72)
# liquidctl initialize all
NZXT Smart Device (V1)
├── Firmware version 1.0.7
├── Firmware version 1.7
├── LED accessories 2
├── LED accessory type HUE+ Strip
└── LED count (total) 20

View File

@ -30,7 +30,7 @@ fan control and all lighting effects will be available.
```
# liquidctl initialize
NZXT Smart Device (V1)
├── Firmware version 1.0.7
├── Firmware version 1.7
├── LED accessories 2
├── LED accessory type HUE+ Strip
└── LED count (total) 20

View File

@ -13,7 +13,7 @@ Device #3: NZXT Kraken X (X42, X52, X62 or X72)
# liquidctl initialize all
NZXT Smart Device (V1)
├── Firmware version 1.0.7
├── Firmware version 1.7
├── LED accessories 2
├── LED accessory type HUE+ Strip
└── LED count (total) 20

View File

@ -285,9 +285,13 @@ class SmartDevice(_BaseSmartDevice):
self.device.clear_enqueued_reports()
msg = self.device.read(self._READ_LENGTH)
fw = tuple(msg[0xb:0xf])
_LOGGER.debug('raw firmware version: %r', fw)
fw = '{}.{}.{}'.format(msg[0xb], msg[0xc] << 8 | msg[0xd], msg[0xe])
ret = [('Firmware version', fw, '')]
# NZXT/CAM has simplified how they report the firmware version from its
# raw 4-component form
fw_human = f'{fw[0]}.{fw[3]}'
ret = [('Firmware version', fw_human, '')]
if self._color_channels:
lcount = msg[0x11]

View File

@ -55,7 +55,7 @@ def test_smart_device_initializes(mockSmartDevice, has_hwmon, direct_access, tmp
dev.device.preload_read(Report(capdata[0], capdata[1:]))
expected = [
('Firmware version', '1.0.7', ''),
('Firmware version', '1.7', ''),
('LED accessories', 2, ''),
('LED accessory type', 'HUE+ Strip', ''),
('LED count (total)', 20, ''),