sane defaults on exit

This commit is contained in:
2026-07-21 20:45:02 +02:00
parent 116eb7201f
commit 9419230747

View File

@@ -201,8 +201,6 @@ void aio_detect(struct aio_t *aio) {
applog(LOG_INF, "found Corsair AIO device at %04x:%04x, fw ver: %s. Set point is %.1fC, fan stop %s", AIO_USB_VID, AIO_USB_PID, aio_get_firmware_version(aio->handle, (char[16]){0}), (double)params.fans.setpoint, params.fans.fan_stop ? "ENABLED" : "DISABLED");
aio_set_pump_mode(aio->handle, QUIET); // needed for init ig?
aio_set_color(aio->handle, AIO_COLOR_FIXED, 0, nullptr, 0); // so it doenst complain the func is unused
// aio_set_fan_curve(aio->handle, fan_curve, sizeof(fan_curve) / sizeof(fan_curve[0]));
aio_set_fan_curve(aio->handle, nullptr, 0);
aio_usb_release(aio->handle);
}
@@ -273,6 +271,16 @@ void aio_update(struct aio_t *aio) {
}
void aio_close(const struct aio_t *aio) {
const struct curve_point_t fan_curve[] = {
{ 34, 20},
{ 35, 35 },
{ 39, 50 },
{ 46, 75 },
{ 55, 100}
};
aio_set_pump_mode(aio->handle, BALANCED);
aio_set_fan_curve(aio->handle, fan_curve, sizeof(fan_curve) / sizeof(fan_curve[0]));
libusb_attach_kernel_driver(aio->handle, 0); // reattach so liquidctl still works
libusb_close(aio->handle);
libusb_exit(nullptr);