Expose fan control limitations to userspace

This commit is contained in:
Werner Sembach 2022-10-04 13:59:13 +02:00
parent 47bbd14ca0
commit 44f7fd0151
2 changed files with 23 additions and 1 deletions

View file

@ -32,7 +32,7 @@
MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops"); MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops");
MODULE_AUTHOR("TUXEDO Computers GmbH <tux@tuxedocomputers.com>"); MODULE_AUTHOR("TUXEDO Computers GmbH <tux@tuxedocomputers.com>");
MODULE_VERSION("0.2.4"); MODULE_VERSION("0.2.5");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_ALIAS_CLEVO_INTERFACES(); MODULE_ALIAS_CLEVO_INTERFACES();
@ -358,6 +358,26 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne
result = byte_data; result = byte_data;
copy_result = copy_to_user((void *) arg, &result, sizeof(result)); copy_result = copy_to_user((void *) arg, &result, sizeof(result));
break; break;
case R_UW_FANS_OFF_POSSIBLE:
result = has_universal_ec_fan_control();
if (result == 1) {
result = 0;
}
else if (result == 0) {
result = 1;
}
copy_result = copy_to_user((void *) arg, &result, sizeof(result));
break;
case R_UW_FANSPEED_MIN:
result = has_universal_ec_fan_control();
if (result == 1) {
result = 20;
}
else if (result == 0) {
result = 0;
}
copy_result = copy_to_user((void *) arg, &result, sizeof(result));
break;
#ifdef DEBUG #ifdef DEBUG
case R_TF_BC: case R_TF_BC:
copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg)); copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg));

View file

@ -79,6 +79,8 @@
#define R_UW_MODE _IOR(MAGIC_READ_UW, 0x14, int32_t*) #define R_UW_MODE _IOR(MAGIC_READ_UW, 0x14, int32_t*)
#define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x15, int32_t*) #define R_UW_MODE_ENABLE _IOR(MAGIC_READ_UW, 0x15, int32_t*)
#define R_UW_FANS_OFF_POSSIBLE _IOR(MAGIC_READ_UW, 0x16, int32_t*)
#define R_UW_FANSPEED_MIN _IOR(MAGIC_READ_UW, 0x17, int32_t*)
// Write // Write
#define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*) #define W_UW_FANSPEED _IOW(MAGIC_WRITE_UW, 0x10, int32_t*)