Commit Graph

278 Commits

Author SHA1 Message Date
Jonas Malaco 2dd235e536 corsair_hid_psu: read exactly 4 bytes for timedeltas
The response from the device may contain non-nil bytes beyond the range
applicable to the command being replied to.

This is generally taken care of by LINEAR11, ULINEAR16, or when reading
a single byte. However, as we weren't sure how many bytes could actually
be returned by _get_timedelta, it was allowed to try and parse the
entire response as an integer.

That was fine since we were reading with little endianess, and no
devices were known that actually send extra non-nil bytes. That has
changed with the H1500i: only 4 bytes can be safely read from the
response.

Fix _get_timedelta with this new information.

Fixes: #575
Fixes: 64523ef337
2023-02-26 15:31:06 -03:00
Jonas Malaco 4c981275b9 corsair_hid_psu: assert that the response matches the command sent
A rare and so far not well understood issue with these PSUs has been an
occasional exception being thrown from timedelta:

    OverflowError: Python int too large to convert to C int

In both cases for which we have debug infos, #463 and #192 (part), it
seems that the cause is an invalid response from the PSU, probably
because of a race with another program simultaneously accessing it.

(A third case has been reported on Discord, but so far no debug info has
been provided to us. Still, it seems likely that once again there's
another program (iCue) in use at the same time as liquidctl).

Check the response matches the command sent in _exec, and if that fails,
suggest that a possible conflict with another program might be the
cause.

Also fix a small issue with how the mock used for unit testing
automatically preloads reports for future impending reads, which up to
this point failed to consider the write bit (which, for the OCP mode,
can be both write=0 or read=1).

Fixes: #463
Related: #192
2023-01-12 07:18:01 -03:00
Aleksa Savić 25447b7464
nzxt-kraken3: add support for expanded hwmon driver capabilities (#529)
* Initial sensor reading support from hwmon for X53 and Z53

* Remove superflous get_status from KrakenZ3

* KrakenX3: read pump duty from hwmon, if available

* Initial support for setting fixed duty through hwmon and directly

* Refactor hwmon_ctrl_mapping info outside of classes

Will fix tests later

* Implement speed profile setting through hwmon; store only hwmon channel no in hwmon_ctrl_mapping

* Initial test fixing

* Test Z3 reading from hwmon, todo reading directly

* Separate X3 and Z3 status reports; add Z3 direct access status report testing

* Fix 1.4.x backward compatibility test

* Add changed in note to kraken 3 guide docs

* Mark Kraken Z3 with h in README

* Note Z3 in guide for hwmon as well

* Add tests for setting fixed duty directly for Kraken X3 and Z3

* Add tests for setting fixed duty through hwmon for Kraken X3 and Z3

* Add test for setting Kraken X3 speed profile directly

* Add test for setting Kraken Z3 speed profile directly

* Check pwmX_enable availability instead for setting speed profiles through hwmon

* Refactor PWM output of test curve; add test for setting Kraken X3 speed profile through hwmon

* Add test for setting speed profiles for Kraken Z3 through hwmon

* Fan has a min duty of 0% on Kraken Z3, update the guide

* Test fan report as well

* Add explanation of why we wait before setting pwmX_enable to 2
2022-11-25 22:21:57 +01:00
Jonas Malaco c75503b938 asetek_pro: move firmware version to initialize output 2022-11-21 18:03:03 -03:00
Jonas Malaco 12c1469909 tests: re-enabled hid_read use/timeout assertion
Fixes: f0aa68c0b8
2022-11-10 15:27:22 -03:00
Jonas Malaco 113a954f29 readme: simplify and improve comments in API example 2022-10-21 03:18:32 -03:00
Aleksa Savić 8040392773
aquacomputer: add support for reading virtual temp sensors on Quadro (#528) 2022-10-19 19:40:40 -03:00
Aleksa Savić 0b2c265fa6
aquacomputer: add support for reading virtual temp sensors on Farbwerk 360 (#527) 2022-10-19 10:12:32 -03:00
Aleksa Savić cc4bc98cb9
aquacomputer: add support for reading virtual temp sensors on Aquacomputer Octo (#525) 2022-10-18 09:27:52 -03:00
Marshall Asch c03b445d0a
commander_pro: add support for changing fan modes during init (#474)
Closes: #472.
2022-10-16 21:20:44 -03:00
Aleksa Savić 758daaa0dc
aquacomputer: add support for reading virtual temp sensors on D5 Next (#510) 2022-10-16 03:43:45 -03:00
Aleksa Savić 2db6d80308
aquacomputer: add support for setting fan speed for Quadro (#509) 2022-09-23 14:48:25 -03:00
Aleksa Savić e63fdf60f1
aquacomputer: add support for setting fan speed for Octo (#508) 2022-09-23 14:10:47 -03:00
Jonas Malaco f0aa68c0b8 usb: add default timeouts to all IO methods that support them
Fixes: #488
Related: #497, partially: hid.device.write doesn't support a timeout
Related: #505
Related: #506
2022-09-23 03:20:25 -03:00
Jonas Malaco ad6a6a625a hydro_platinum: replace compute_pec with more efficient mkCrcFun 2022-09-22 00:48:56 -03:00
Jonas Malaco daa7d6db7c krakenz3_response: turn black off locally instead of globally 2022-09-21 23:44:42 -03:00
Aleksa Savić d097e66393
hwmon: rename get_int to read_int (#507) 2022-09-21 14:55:05 -03:00
Aleksa Savić a81c9b53e6
aquacomputer: add support for setting fan speed for D5 Next (#499) 2022-09-21 13:53:41 -03:00
Shady Nawara f455e3f446
kraken3: add LCD screen support for Kraken Z coolers (#479)
Closes: #444
2022-09-18 01:22:45 -03:00
Meriemi a2b4391408
commander_core: support 2.10.219 firmware (#501)
Fixes: #464
Related: #455
2022-09-13 13:45:22 -03:00
Jonas Malaco 9d85834411 hwmon: record driver name instead of module name
This is what we're ultimately interested in anyway.  And only fetching
the driver name, instead of the module name, still works even if the
driver was built into the kernel.

Fixes: #502
2022-08-31 14:18:34 -03:00
Aleksa Savić 7817639e55
aquacomputer: add Quadro support (#493) 2022-08-22 12:25:02 -03:00
Aleksa Savić 72968d5a5d
aquacomputer: add Octo support (#492) 2022-08-11 15:15:54 -03:00
Jonas Malaco c4525f84d9 corsair_hid_psu: fix new temperature sensor names
Commit f749c94809 ended up with experimental names in the code, and
the final names only in the documentation.  Make the code use the final
names as well.

Fixes: f749c94809
2022-08-11 07:19:53 -03:00
Jonas Malaco f749c94809 corsair_hid_psu: rename temperature sensors according to their location
The association from sensors to corresponding components is taken from
the corsair-psu Linxu hwmon driver.[^1]

A grep-backward-compatible alternative was considered

    Temperature <n> -> Temperature <n> (<location>)

... but would result in very long names.  Additionally, the specific
items returned from get_status() are *not* stable.[^2][^3]

[^1]: https://www.kernel.org/doc/html/v5.11/hwmon/corsair-psu.html
[^2]: docs/developer/process.md#stability-and-backward-compatibility
2022-08-11 07:14:30 -03:00
Aleksa Savić 747af54660
aquacomputer: add Farbwerk 360 support (#491) 2022-08-09 10:39:32 -03:00
Jonas Malaco 9ff219bf34 Remove unused reserved value from USB driver _MATCHES tuples
It was originally reserved for matching against the USB bcdDevice
descriptor, but in all these years it hasn't been useful once.
2022-08-05 20:55:34 -03:00
Jonas Malaco 4e1ed5b0bf usb: make SUPPORTED_DEVICES private
This fixes a mistake from pre-1.0 liquidctl and gives us flexibility to
change the structure used to hold that data, if that turns out to be
beneficial in the future.

Additionally, the new class field is called _MATCHES, following what was
used in the later nvidia module.

As far as I can tell the only external user of this field is Coolero,
and I'll submit a patch shortly to prevent any breakage there.

Keeping a temporary alias during some deprecation period was considered,
but isn't trivial since this is a class not instance field.  As there's
only a single external user, it's easier to just fix it.

Finally, a typical Coolero installation generally bundles a specific
liquidctl version, and otherwise existing global setups shouldn't go
through the affected path (before an update) since it's in a test.
2022-08-05 20:15:31 -03:00
Aleksa Savić 42a5e7a4df
aquacomputer: add driver for D5 Next sensor readings (#482)
See PR #482 for the original changelog.
2022-08-03 17:34:12 -03:00
Shawn Anastasio f417affd36 Commander Core: Add support for the Commander Core XT
Update the Commander Core to recognize the Commander Core XT Product ID,
and update channel/temperature naming across the driver to account for
the lack of an AIO on this variant of the device. Other than this, the
protocol appears identical and at least fan speed readout and control
have been tested by me.
2022-07-14 21:54:59 -05:00
Jonas Malaco 25b64aa763 keyval: skip symlink test if on Windows with insufficient permissions
Creating symlinks on Windows is, by default, a privileged operation.
From the `os.symlink()` documentation:

> On newer versions of Windows 10, unprivileged accounts can create
> symlinks if Developer Mode is enabled. When Developer Mode is not
> available/enabled, the SeCreateSymbolicLinkPrivilege privilege is
> required, or the process must be run as an administrator.

While it is important to test that our keyval storage is consistent even
with pathological symlinks, we shouldn't break the test suite if we're
unable to run this test because the user/developer hasn't enabled
developer mode.

Fixes: #460
2022-05-30 11:44:33 -03:00
Jonas Malaco 0839a571a0 aura_led: capitalize "asus" name for consistency with previous code 2022-05-30 11:18:31 -03:00
Jonas Malaco 344ce6b7b5 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).
2022-05-30 11:05:59 -03:00
Jonas Malaco 12f7853e3c kraken2: report modern firmware versions in simplified form
The different ways the firmware version is reported by liquidctl and CAM
causes some confusion, of at least surprise; CAM uses a simplified
2-digit form since the migration to the unified 5.x/6.x firmware.

Change how liquidctl reports the version for modern firmware to match
CAM, but retain the 3-digit form for 2.x/3.x firmware [and earlier].
Also log the raw firmware tuple with debug level.
2022-05-30 08:16:57 -03:00
CaseySJ 622d83c428
aura_led: add driver for Asus Aura LED USB controllers (#456) 2022-05-27 20:58:14 -03:00
Eugenio Rossi b66268e388
Support for NZXT H1 V2 case Smart Device (#451) 2022-05-05 06:38:53 -03:00
Jonas Malaco bc7f7371f4 kraken2: remove deprecated firmware version from get_status()
As previously documented/communicated, it would only be kept for the
1.9.x release cycle, and this branch already tracks the 1.10.0 release.
2022-04-06 01:26:01 -03:00
Jonas Malaco a7250b65a6 hwmon: remove _input suffix from pwmN attributes (cont.)
Closes: #446
Fixes: #445
2022-04-05 16:47:02 -03:00
Jonas Malaco e4d59c2059 kraken2: fix test cases that expected fwversion as tuple
Fixes: b328b23acb ("kraken2: return the firmware version as a string")
Fixes: 5dc22aa260 ("kraken2: get status from hwmon if possible")
2022-04-05 02:53:27 -03:00
Jonas Malaco 5df10bcf4b asetek_pro: rename CorsairAsetekProDriver to HydroPro
An alias is kept with the old name, for backward compatibility.
2022-03-04 09:59:52 -03:00
Jonas Malaco e9273093db nvidia: rog_turing: enable support for more cards
They reportedly use the same controller and protocol as the already
supported 1070 (OC) and 2080 Ti OC.[^1]

But, for the time being, list them with the "experimental" tag.

[^1]: d8f28b546d/Controllers/AsusAuraGPUController/AsusAuraGPUControllerDetect.cpp (L37-76)
2022-03-02 06:15:34 -03:00
Jonas Malaco d9bbcfe48d nvidia: evga_pascal: enable support for 1070 and 1070 Ti cards
They reportedly use the same controller and protocol as the 1080
FTW.[^1]

But, for the time being, list them with the "experimental" tag.

[^1]: d8f28b546d/Controllers/EVGAPascalGPUController/EVGAPascalGPUControllerDetect.cpp (L25-29)
2022-03-02 06:15:30 -03:00
Jonas Malaco 35d8e19a88 Merge branch 'main' into recognize-hwmon-devices 2022-02-26 06:46:21 -03:00
Jonas Malaco 18d3898171 liquidctl: re-export __version__ at the root 2022-02-26 06:35:18 -03:00
Jonas Malaco b213480de5 corsair_hid_psu: get status from hwmon if possible
Related: #403
2022-02-23 05:27:16 -03:00
Jonas Malaco 0a1048eabe corsair_hid_psu: don't re-initialize if there's a hwmon driver
Related: #403
2022-02-23 05:27:12 -03:00
Jonas Malaco 4dfb3c5042 smart_device: v2: get status from hwmon if possible
In addition, report devices with no detected fans, as well as speeds and
PWM duty values even in those cases.

Related: #403
2022-02-23 05:26:57 -03:00
Jonas Malaco 028c6a99a4 smart_device: v2: don't re-initialize if there's a hwmon driver
Firmware and lighting information will still be fetched and returned.

Related: #403
2022-02-23 05:26:53 -03:00
Jonas Malaco e01b05607f smart_device: v1: get status from hwmon if possible
Related: #403
2022-02-23 05:26:38 -03:00
Jonas Malaco 0bc9f09c80 smart_device: v1: move firmware and LED accessory to initialize()
According to our documented policy, this is not a breaking change:[^1]

> 4. The output from CLI commands is *not* guaranteed to be stable,
> 5. and neither are the items returned from `get_status()` or `initialize()`.

Additionally, some current users of that information already need to be
fixed and call/execute initialize in the first place.

Finally, this allows us to have get_status() return data from hwmon,
when possible, and where firmware and LED accessory information is not
available.

[^1]: docs/developer/process.md ("Stability and backward compatibility" section)
2022-02-23 05:26:11 -03:00