// SPDX-License-Identifier: GPL-2.0+ /* * nzxt-kraken2.c - hwmon driver for NZXT Kraken X42/X52/X62/X72 coolers * * The device asynchronously sends HID reports (with id 0x04) twice a second to * communicate current fan speed, pump speed and coolant temperature. The * device does not respond to Get_Report requests for this status report. * * Copyright 2019-2021 Jonas Malaco <jonas@protocubo.io>
*/
if (size < 7 || report->id != STATUS_REPORT_ID) return 0;
priv = hid_get_drvdata(hdev);
/* * The fractional byte of the coolant temperature has been observed to * be in the interval [1,9], but some of these steps are also * consistently skipped for certain integer parts. * * For the lack of a better idea, assume that the resolution is 0.1°C, * and that the missing steps are artifacts of how the firmware * processes the raw sensor data.
*/
priv->temp_input[0] = data[1] * 1000 + data[2] * 100;
/* * Initialize ->updated to STATUS_VALIDITY seconds in the past, making * the initial empty data invalid for kraken2_read without the need for * a special case there.
*/
priv->updated = jiffies - STATUS_VALIDITY * HZ;
ret = hid_parse(hdev); if (ret) {
hid_err(hdev, "hid parse failed with %d\n", ret); return ret;
}
/* * Enable hidraw so existing user-space tools can continue to work.
*/
ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); if (ret) {
hid_err(hdev, "hid hw start failed with %d\n", ret); return ret;
}
ret = hid_hw_open(hdev); if (ret) {
hid_err(hdev, "hid hw open failed with %d\n", ret); goto fail_and_stop;
}
priv->hwmon_dev = hwmon_device_register_with_info(&hdev->dev, "kraken2",
priv, &kraken2_chip_info,
NULL); if (IS_ERR(priv->hwmon_dev)) {
ret = PTR_ERR(priv->hwmon_dev);
hid_err(hdev, "hwmon registration failed with %d\n", ret); goto fail_and_close;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.