diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index d03befe..11d7ab1 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -65,8 +65,18 @@ static long clevo_ioctl_interface(struct file *file, unsigned int cmd, unsigned u32 result = 0, status; u32 copy_result; u32 argument = (u32) arg; + + const char str_no_if[] = ""; + char *str_clevo_if; switch (cmd) { + case R_HW_IF_STR: + if (clevo_get_active_interface_id(&str_clevo_if) == 0) { + copy_result = copy_to_user((char *) arg, str_clevo_if, strlen(str_clevo_if) + 1); + } else { + copy_result = copy_to_user((char *) arg, str_no_if, strlen(str_no_if) + 1); + } + break; case R_FANINFO1: status = clevo_evaluate_method(CLEVO_CMD_GET_FANINFO1, 0, &result); copy_result = copy_to_user((int32_t *) arg, &result, sizeof(result)); diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index c97b228..22ab9d2 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -1,9 +1,9 @@ /*! * Copyright (c) 2019-2020 TUXEDO Computers GmbH * - * This file is part of tuxedo-cc-wmi. + * This file is part of tuxedo-io. * - * tuxedo-cc-wmi is free software: you can redistribute it and/or modify + * tuxedo-io is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. @@ -21,24 +21,25 @@ #define IOCTL_MAGIC 0xEC -#define MAGIC_READ_CL IOCTL_MAGIC -#define MAGIC_WRITE_CL IOCTL_MAGIC + 1 +#define MAGIC_READ_CL IOCTL_MAGIC + 1 +#define MAGIC_WRITE_CL IOCTL_MAGIC + 2 -#define MAGIC_READ_UW IOCTL_MAGIC + 2 -#define MAGIC_WRITE_UW IOCTL_MAGIC + 3 +#define MAGIC_READ_UW IOCTL_MAGIC + 3 +#define MAGIC_WRITE_UW IOCTL_MAGIC + 4 // General #define R_MOD_VERSION _IOR(IOCTL_MAGIC, 0x00, char*) -#define R_HWCHECK_CL _IOR(IOCTL_MAGIC, 0x05, char*) -#define R_HWCHECK_UW _IOR(IOCTL_MAGIC, 0x06, char*) +#define R_HWCHECK_CL _IOR(IOCTL_MAGIC, 0x05, int32_t*) +#define R_HWCHECK_UW _IOR(IOCTL_MAGIC, 0x06, int32_t*) /** * Clevo interface */ // Read +#define R_HW_IF_STR _IOR(MAGIC_READ_CL, 0x00, char*) #define R_FANINFO1 _IOR(MAGIC_READ_CL, 0x10, int32_t*) #define R_FANINFO2 _IOR(MAGIC_READ_CL, 0x11, int32_t*) #define R_FANINFO3 _IOR(MAGIC_READ_CL, 0x12, int32_t*)