mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Convert project to Linux Kernel Coding style using GNU indent
indent -kr -i8 -ts8 -sob -l80 -ss -bs -psl tuxedo_keyboard.*
This commit is contained in:
parent
b0f76c723f
commit
41623907ad
|
@ -27,24 +27,27 @@
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
|
|
||||||
MODULE_AUTHOR("Christian Loritz / TUXEDO Computer GmbH <tux@tuxedocomputers.com>");
|
MODULE_AUTHOR
|
||||||
|
("Christian Loritz / TUXEDO Computer GmbH <tux@tuxedocomputers.com>");
|
||||||
MODULE_DESCRIPTION("TUXEDO Computer Keyboard Backlight Driver");
|
MODULE_DESCRIPTION("TUXEDO Computer Keyboard Backlight Driver");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
MODULE_VERSION("1.0.0");
|
MODULE_VERSION("1.0.0");
|
||||||
|
|
||||||
// Sysfs Interface for the keyboard state (ON / OFF)
|
// Sysfs Interface for the keyboard state (ON / OFF)
|
||||||
static ssize_t show_state_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_state_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%d\n", keyboard.state);
|
return sprintf(buffer, "%d\n", keyboard.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_state_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_state_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int ret = kstrtouint(buffer, 0, &val);
|
int ret = kstrtouint(buffer, 0, &val);
|
||||||
|
|
||||||
if (ret)
|
if (ret) {
|
||||||
{
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,63 +59,82 @@ static ssize_t set_state_fs(struct device *child, struct device_attribute *attr,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for the color of the left side (Color as hexvalue)
|
// Sysfs Interface for the color of the left side (Color as hexvalue)
|
||||||
static ssize_t show_color_left_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_color_left_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%06x\n", keyboard.color.left);
|
return sprintf(buffer, "%06x\n", keyboard.color.left);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_color_left_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_color_left_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
return set_color_region(buffer, size, REGION_LEFT);
|
return set_color_region(buffer, size, REGION_LEFT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for the color of the center (Color as hexvalue)
|
// Sysfs Interface for the color of the center (Color as hexvalue)
|
||||||
static ssize_t show_color_center_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_color_center_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%06x\n", keyboard.color.center);
|
return sprintf(buffer, "%06x\n", keyboard.color.center);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_color_center_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_color_center_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
return set_color_region(buffer, size, REGION_CENTER);
|
return set_color_region(buffer, size, REGION_CENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for the color of the right side (Color as hexvalue)
|
// Sysfs Interface for the color of the right side (Color as hexvalue)
|
||||||
static ssize_t show_color_right_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_color_right_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%06x\n", keyboard.color.right);
|
return sprintf(buffer, "%06x\n", keyboard.color.right);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_color_right_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_color_right_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
return set_color_region(buffer, size, REGION_RIGHT);
|
return set_color_region(buffer, size, REGION_RIGHT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for the color of the extra region (Color as hexvalue)
|
// Sysfs Interface for the color of the extra region (Color as hexvalue)
|
||||||
static ssize_t show_color_extra_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_color_extra_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%06x\n", keyboard.color.extra);
|
return sprintf(buffer, "%06x\n", keyboard.color.extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_color_extra_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_color_extra_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
return set_color_region(buffer, size, REGION_EXTRA);
|
return set_color_region(buffer, size, REGION_EXTRA);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for the keyboard brightness (unsigned int)
|
// Sysfs Interface for the keyboard brightness (unsigned int)
|
||||||
static ssize_t show_brightness_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_brightness_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%d\n", keyboard.brightness);
|
return sprintf(buffer, "%d\n", keyboard.brightness);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_brightness_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_brightness_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
// hier unsigned?
|
// hier unsigned?
|
||||||
int ret = kstrtouint(buffer, 0, &val);
|
int ret = kstrtouint(buffer, 0, &val);
|
||||||
|
|
||||||
if (ret)
|
if (ret) {
|
||||||
{
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,18 +145,20 @@ static ssize_t set_brightness_fs(struct device *child, struct device_attribute *
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for the keyboard mode
|
// Sysfs Interface for the keyboard mode
|
||||||
static ssize_t show_mode_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_mode_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%d\n", keyboard.mode);
|
return sprintf(buffer, "%d\n", keyboard.mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t set_mode_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size)
|
static ssize_t
|
||||||
|
set_mode_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size)
|
||||||
{
|
{
|
||||||
unsigned int val;
|
unsigned int val;
|
||||||
int ret = kstrtouint(buffer, 0, &val);
|
int ret = kstrtouint(buffer, 0, &val);
|
||||||
|
|
||||||
if (ret)
|
if (ret) {
|
||||||
{
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,91 +169,97 @@ static ssize_t set_mode_fs(struct device *child, struct device_attribute *attr,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sysfs Interface for if the keyboard has extra region
|
// Sysfs Interface for if the keyboard has extra region
|
||||||
static ssize_t show_hasextra_fs(struct device *child, struct device_attribute *attr, char *buffer)
|
static ssize_t
|
||||||
|
show_hasextra_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
char *buffer)
|
||||||
{
|
{
|
||||||
return sprintf(buffer, "%d\n", keyboard.has_extra);
|
return sprintf(buffer, "%d\n", keyboard.has_extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init tuxdeo_keyboard_init(void)
|
static int __init
|
||||||
|
tuxdeo_keyboard_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
if (!wmi_has_guid(CLEVO_EVENT_GUID))
|
if (!wmi_has_guid(CLEVO_EVENT_GUID)) {
|
||||||
{
|
|
||||||
TUXEDO_ERROR("No known WMI event notification GUID found\n");
|
TUXEDO_ERROR("No known WMI event notification GUID found\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wmi_has_guid(CLEVO_GET_GUID))
|
if (!wmi_has_guid(CLEVO_GET_GUID)) {
|
||||||
{
|
|
||||||
TUXEDO_ERROR("No known WMI control method GUID found\n");
|
TUXEDO_ERROR("No known WMI control method GUID found\n");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
}
|
}
|
||||||
|
|
||||||
TUXEDO_INFO("Model '%s' found\n", dmi_get_system_info(DMI_PRODUCT_NAME));
|
TUXEDO_INFO("Model '%s' found\n",
|
||||||
|
dmi_get_system_info(DMI_PRODUCT_NAME));
|
||||||
|
|
||||||
tuxedo_platform_device = platform_create_bundle(&tuxedo_platform_driver, tuxedo_wmi_probe, NULL, 0, NULL, 0);
|
tuxedo_platform_device =
|
||||||
if (unlikely(IS_ERR(tuxedo_platform_device)))
|
platform_create_bundle(&tuxedo_platform_driver, tuxedo_wmi_probe,
|
||||||
{
|
NULL, 0, NULL, 0);
|
||||||
|
if (unlikely(IS_ERR(tuxedo_platform_device))) {
|
||||||
TUXEDO_ERROR("Can not init Platform driver");
|
TUXEDO_ERROR("Can not init Platform driver");
|
||||||
return PTR_ERR(tuxedo_platform_device);
|
return PTR_ERR(tuxedo_platform_device);
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tuxedo_input_init();
|
err = tuxedo_input_init();
|
||||||
if (unlikely(err))
|
if (unlikely(err)) {
|
||||||
{
|
|
||||||
TUXEDO_ERROR("Could not register input device\n");
|
TUXEDO_ERROR("Could not register input device\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_state) != 0)
|
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_state) !=
|
||||||
{
|
0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for state\n");
|
TUXEDO_ERROR("Sysfs attribute creation failed for state\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_color_left) != 0)
|
if (device_create_file
|
||||||
{
|
(&tuxedo_platform_device->dev, &dev_attr_color_left) != 0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for color left\n");
|
TUXEDO_ERROR
|
||||||
|
("Sysfs attribute creation failed for color left\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_color_center) != 0)
|
if (device_create_file
|
||||||
{
|
(&tuxedo_platform_device->dev, &dev_attr_color_center) != 0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for color center\n");
|
TUXEDO_ERROR
|
||||||
|
("Sysfs attribute creation failed for color center\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_color_right) != 0)
|
if (device_create_file
|
||||||
{
|
(&tuxedo_platform_device->dev, &dev_attr_color_right) != 0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for color right\n");
|
TUXEDO_ERROR
|
||||||
|
("Sysfs attribute creation failed for color right\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(set_color(REGION_EXTRA, KB_COLOR_DEFAULT) != 0)
|
if (set_color(REGION_EXTRA, KB_COLOR_DEFAULT) != 0) {
|
||||||
{
|
|
||||||
TUXEDO_DEBUG("Keyboard does not support EXTRA Color");
|
TUXEDO_DEBUG("Keyboard does not support EXTRA Color");
|
||||||
keyboard.has_extra = 0;
|
keyboard.has_extra = 0;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
keyboard.has_extra = 1;
|
keyboard.has_extra = 1;
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_color_extra) != 0)
|
if (device_create_file
|
||||||
{
|
(&tuxedo_platform_device->dev,
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for color extra\n");
|
&dev_attr_color_extra) != 0) {
|
||||||
|
TUXEDO_ERROR
|
||||||
|
("Sysfs attribute creation failed for color extra\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
set_color(REGION_EXTRA, param_color_extra);
|
set_color(REGION_EXTRA, param_color_extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_extra) != 0)
|
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_extra) !=
|
||||||
{
|
0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for extra information flag\n");
|
TUXEDO_ERROR
|
||||||
|
("Sysfs attribute creation failed for extra information flag\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_mode) != 0)
|
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_mode) !=
|
||||||
{
|
0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for mode\n");
|
TUXEDO_ERROR("Sysfs attribute creation failed for mode\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device_create_file(&tuxedo_platform_device->dev, &dev_attr_brightness) != 0)
|
if (device_create_file
|
||||||
{
|
(&tuxedo_platform_device->dev, &dev_attr_brightness) != 0) {
|
||||||
TUXEDO_ERROR("Sysfs attribute creation failed for brightness\n");
|
TUXEDO_ERROR
|
||||||
|
("Sysfs attribute creation failed for brightness\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
keyboard.color.left = param_color_left;
|
keyboard.color.left = param_color_left;
|
||||||
|
@ -248,21 +278,23 @@ static int __init tuxdeo_keyboard_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit tuxdeo_keyboard_exit(void)
|
static void __exit
|
||||||
|
tuxdeo_keyboard_exit(void)
|
||||||
{
|
{
|
||||||
tuxedo_input_exit();
|
tuxedo_input_exit();
|
||||||
|
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_state);
|
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_state);
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_color_left);
|
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_color_left);
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_color_center);
|
device_remove_file(&tuxedo_platform_device->dev,
|
||||||
|
&dev_attr_color_center);
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_color_right);
|
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_color_right);
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_extra);
|
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_extra);
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_mode);
|
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_mode);
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_brightness);
|
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_brightness);
|
||||||
|
|
||||||
if(keyboard.has_extra == 1)
|
if (keyboard.has_extra == 1) {
|
||||||
{
|
device_remove_file(&tuxedo_platform_device->dev,
|
||||||
device_remove_file(&tuxedo_platform_device->dev, &dev_attr_color_extra);
|
&dev_attr_color_extra);
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_device_unregister(tuxedo_platform_device);
|
platform_device_unregister(tuxedo_platform_device);
|
||||||
|
@ -272,13 +304,13 @@ static void __exit tuxdeo_keyboard_exit(void)
|
||||||
TUXEDO_DEBUG("exit");
|
TUXEDO_DEBUG("exit");
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __init tuxedo_input_init(void)
|
static int __init
|
||||||
|
tuxedo_input_init(void)
|
||||||
{
|
{
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
tuxedo_input_device = input_allocate_device();
|
tuxedo_input_device = input_allocate_device();
|
||||||
if (unlikely(!tuxedo_input_device))
|
if (unlikely(!tuxedo_input_device)) {
|
||||||
{
|
|
||||||
TUXEDO_ERROR("Error allocating input device\n");
|
TUXEDO_ERROR("Error allocating input device\n");
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
|
@ -291,24 +323,23 @@ static int __init tuxedo_input_init(void)
|
||||||
set_bit(EV_KEY, tuxedo_input_device->evbit);
|
set_bit(EV_KEY, tuxedo_input_device->evbit);
|
||||||
|
|
||||||
err = input_register_device(tuxedo_input_device);
|
err = input_register_device(tuxedo_input_device);
|
||||||
if (unlikely(err))
|
if (unlikely(err)) {
|
||||||
{
|
|
||||||
TUXEDO_ERROR("Error registering input device\n");
|
TUXEDO_ERROR("Error registering input device\n");
|
||||||
goto err_free_input_device;
|
goto err_free_input_device;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err_free_input_device:
|
err_free_input_device:
|
||||||
input_free_device(tuxedo_input_device);
|
input_free_device(tuxedo_input_device);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void __exit tuxedo_input_exit(void)
|
static void __exit
|
||||||
|
tuxedo_input_exit(void)
|
||||||
{
|
{
|
||||||
if (unlikely(!tuxedo_input_device))
|
if (unlikely(!tuxedo_input_device)) {
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,17 +349,20 @@ static void __exit tuxedo_input_exit(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tuxedo_wmi_probe(struct platform_device *dev)
|
static int
|
||||||
|
tuxedo_wmi_probe(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
status = wmi_install_notify_handler(CLEVO_EVENT_GUID, tuxedo_wmi_notify, NULL);
|
status =
|
||||||
|
wmi_install_notify_handler(CLEVO_EVENT_GUID, tuxedo_wmi_notify,
|
||||||
|
NULL);
|
||||||
// neuer name?
|
// neuer name?
|
||||||
TUXEDO_DEBUG("clevo_xsm_wmi_probe status: (%0#6x)", status);
|
TUXEDO_DEBUG("clevo_xsm_wmi_probe status: (%0#6x)", status);
|
||||||
|
|
||||||
if (unlikely(ACPI_FAILURE(status)))
|
if (unlikely(ACPI_FAILURE(status))) {
|
||||||
{
|
TUXEDO_ERROR("Could not register WMI notify handler (%0#6x)\n",
|
||||||
TUXEDO_ERROR("Could not register WMI notify handler (%0#6x)\n", status);
|
status);
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -337,54 +371,53 @@ static int tuxedo_wmi_probe(struct platform_device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tuxedo_wmi_remove(struct platform_device *dev)
|
static int
|
||||||
|
tuxedo_wmi_remove(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
wmi_remove_notify_handler(CLEVO_EVENT_GUID);
|
wmi_remove_notify_handler(CLEVO_EVENT_GUID);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tuxedo_wmi_resume(struct platform_device *dev)
|
static int
|
||||||
|
tuxedo_wmi_resume(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
tuxedo_evaluate_method(GET_AP, 0, NULL);
|
tuxedo_evaluate_method(GET_AP, 0, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tuxedo_wmi_notify(u32 value, void *context)
|
static void
|
||||||
|
tuxedo_wmi_notify(u32 value, void *context)
|
||||||
{
|
{
|
||||||
u32 event;
|
u32 event;
|
||||||
|
|
||||||
tuxedo_evaluate_method(GET_EVENT, 0, &event);
|
tuxedo_evaluate_method(GET_EVENT, 0, &event);
|
||||||
TUXEDO_DEBUG("WMI event (%0#6x)\n", event);
|
TUXEDO_DEBUG("WMI event (%0#6x)\n", event);
|
||||||
|
|
||||||
switch(event)
|
switch (event) {
|
||||||
{
|
|
||||||
case WMI_CODE_DECREASE_BACKLIGHT:
|
case WMI_CODE_DECREASE_BACKLIGHT:
|
||||||
if(keyboard.brightness == BRIGHTNESS_MIN || (keyboard.brightness - 25) < BRIGHTNESS_MIN)
|
if (keyboard.brightness == BRIGHTNESS_MIN
|
||||||
{
|
|| (keyboard.brightness - 25) < BRIGHTNESS_MIN) {
|
||||||
set_brightness(BRIGHTNESS_MIN);
|
set_brightness(BRIGHTNESS_MIN);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
set_brightness(keyboard.brightness - 25);
|
set_brightness(keyboard.brightness - 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WMI_CODE_INCREASE_BACKLIGHT:
|
case WMI_CODE_INCREASE_BACKLIGHT:
|
||||||
if(keyboard.brightness == BRIGHTNESS_MAX || (keyboard.brightness + 25) > BRIGHTNESS_MAX)
|
if (keyboard.brightness == BRIGHTNESS_MAX
|
||||||
{
|
|| (keyboard.brightness + 25) > BRIGHTNESS_MAX) {
|
||||||
set_brightness(BRIGHTNESS_MAX);
|
set_brightness(BRIGHTNESS_MAX);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
set_brightness(keyboard.brightness + 25);
|
set_brightness(keyboard.brightness + 25);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WMI_CODE_NEXT_MODE:
|
case WMI_CODE_NEXT_MODE:
|
||||||
set_mode((keyboard.mode + 1) > (ARRAY_SIZE(modes) - 1) ? 0 : (keyboard.mode + 1));
|
set_mode((keyboard.mode + 1) >
|
||||||
|
(ARRAY_SIZE(modes) - 1) ? 0 : (keyboard.mode + 1));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WMI_CODE_TOGGLE_STATE:
|
case WMI_CODE_TOGGLE_STATE:
|
||||||
|
@ -396,60 +429,56 @@ static void tuxedo_wmi_notify(u32 value, void *context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_mode(u8 mode)
|
static void
|
||||||
|
set_mode(u8 mode)
|
||||||
{
|
{
|
||||||
TUXEDO_INFO("set_mode on %s", modes[mode].name);
|
TUXEDO_INFO("set_mode on %s", modes[mode].name);
|
||||||
|
|
||||||
if(!tuxedo_evaluate_method(SET_KB_LED, modes[mode].value, NULL))
|
if (!tuxedo_evaluate_method(SET_KB_LED, modes[mode].value, NULL)) {
|
||||||
{
|
|
||||||
keyboard.mode = mode;
|
keyboard.mode = mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mode == 0)
|
if (mode == 0) {
|
||||||
{
|
|
||||||
set_color(REGION_LEFT, keyboard.color.left);
|
set_color(REGION_LEFT, keyboard.color.left);
|
||||||
set_color(REGION_CENTER, keyboard.color.center);
|
set_color(REGION_CENTER, keyboard.color.center);
|
||||||
set_color(REGION_RIGHT, keyboard.color.right);
|
set_color(REGION_RIGHT, keyboard.color.right);
|
||||||
|
|
||||||
if(keyboard.has_extra == 1)
|
if (keyboard.has_extra == 1) {
|
||||||
{
|
|
||||||
set_color(REGION_EXTRA, keyboard.color.extra);
|
set_color(REGION_EXTRA, keyboard.color.extra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_brightness(u8 brightness)
|
static void
|
||||||
|
set_brightness(u8 brightness)
|
||||||
{
|
{
|
||||||
TUXEDO_INFO("Set brightness on %d", brightness);
|
TUXEDO_INFO("Set brightness on %d", brightness);
|
||||||
if (!tuxedo_evaluate_method(SET_KB_LED, 0xF4000000 | brightness, NULL))
|
if (!tuxedo_evaluate_method(SET_KB_LED, 0xF4000000 | brightness, NULL)) {
|
||||||
{
|
|
||||||
keyboard.brightness = brightness;
|
keyboard.brightness = brightness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_kb_state(u8 state)
|
static void
|
||||||
|
set_kb_state(u8 state)
|
||||||
{
|
{
|
||||||
u32 cmd = 0xE0000000;
|
u32 cmd = 0xE0000000;
|
||||||
TUXEDO_INFO("Set keyboard state on: %d\n", state);
|
TUXEDO_INFO("Set keyboard state on: %d\n", state);
|
||||||
|
|
||||||
if(state == 0)
|
if (state == 0) {
|
||||||
{
|
|
||||||
cmd |= 0x003001;
|
cmd |= 0x003001;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
cmd |= 0x07F001;
|
cmd |= 0x07F001;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!tuxedo_evaluate_method(SET_KB_LED, cmd, NULL))
|
if (!tuxedo_evaluate_method(SET_KB_LED, cmd, NULL)) {
|
||||||
{
|
|
||||||
keyboard.state = state;
|
keyboard.state = state;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tuxedo_evaluate_method(u32 method_id, u32 arg, u32 *retval)
|
static int
|
||||||
|
tuxedo_evaluate_method(u32 method_id, u32 arg, u32 * retval)
|
||||||
{
|
{
|
||||||
struct acpi_buffer in = { (acpi_size) sizeof(arg), &arg };
|
struct acpi_buffer in = { (acpi_size) sizeof (arg), &arg };
|
||||||
struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
|
struct acpi_buffer out = { ACPI_ALLOCATE_BUFFER, NULL };
|
||||||
union acpi_object *obj;
|
union acpi_object *obj;
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
@ -457,45 +486,43 @@ static int tuxedo_evaluate_method(u32 method_id, u32 arg, u32 *retval)
|
||||||
|
|
||||||
TUXEDO_DEBUG("evaluate method: %0#4x IN : %0#6x\n", method_id, arg);
|
TUXEDO_DEBUG("evaluate method: %0#4x IN : %0#6x\n", method_id, arg);
|
||||||
|
|
||||||
status = wmi_evaluate_method(CLEVO_GET_GUID, 0x00, method_id, &in, &out);
|
status =
|
||||||
|
wmi_evaluate_method(CLEVO_GET_GUID, 0x00, method_id, &in, &out);
|
||||||
|
|
||||||
if (unlikely(ACPI_FAILURE(status)))
|
if (unlikely(ACPI_FAILURE(status))) {
|
||||||
{
|
|
||||||
TUXEDO_ERROR("evaluate method error");
|
TUXEDO_ERROR("evaluate method error");
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj = (union acpi_object *) out.pointer;
|
obj = (union acpi_object *) out.pointer;
|
||||||
if (obj && obj->type == ACPI_TYPE_INTEGER)
|
if (obj && obj->type == ACPI_TYPE_INTEGER) {
|
||||||
{
|
|
||||||
tmp = (u32) obj->integer.value;
|
tmp = (u32) obj->integer.value;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
tmp = 0;
|
tmp = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
TUXEDO_DEBUG("%0#4x OUT: %0#6x (IN: %0#6x)\n", method_id, tmp, arg);
|
TUXEDO_DEBUG("%0#4x OUT: %0#6x (IN: %0#6x)\n", method_id, tmp, arg);
|
||||||
|
|
||||||
if (likely(retval))
|
if (likely(retval)) {
|
||||||
{
|
|
||||||
*retval = tmp;
|
*retval = tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
kfree(obj);
|
kfree(obj);
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
if (unlikely(ACPI_FAILURE(status)))
|
if (unlikely(ACPI_FAILURE(status))) {
|
||||||
{
|
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_color(u32 region, u32 color)
|
static int
|
||||||
|
set_color(u32 region, u32 color)
|
||||||
{
|
{
|
||||||
u32 cset = ((color & 0x0000FF) << 16) | ((color & 0xFF0000) >> 8) | ((color & 0x00FF00) >> 8);
|
u32 cset =
|
||||||
|
((color & 0x0000FF) << 16) | ((color & 0xFF0000) >> 8) |
|
||||||
|
((color & 0x00FF00) >> 8);
|
||||||
u32 cmd = region | cset;
|
u32 cmd = region | cset;
|
||||||
|
|
||||||
TUXEDO_DEBUG("Set Color '%08x' for region '%08x'", color, region);
|
TUXEDO_DEBUG("Set Color '%08x' for region '%08x'", color, region);
|
||||||
|
@ -503,20 +530,18 @@ static int set_color(u32 region, u32 color)
|
||||||
return tuxedo_evaluate_method(SET_KB_LED, cmd, NULL);
|
return tuxedo_evaluate_method(SET_KB_LED, cmd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int set_color_region(const char *buffer, size_t size, u32 region)
|
static int
|
||||||
|
set_color_region(const char *buffer, size_t size, u32 region)
|
||||||
{
|
{
|
||||||
u32 val;
|
u32 val;
|
||||||
int ret = kstrtouint(buffer, 0, &val);
|
int ret = kstrtouint(buffer, 0, &val);
|
||||||
|
|
||||||
if (ret)
|
if (ret) {
|
||||||
{
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!set_color(region, val))
|
if (!set_color(region, val)) {
|
||||||
{
|
switch (region) {
|
||||||
switch(region)
|
|
||||||
{
|
|
||||||
case REGION_LEFT:
|
case REGION_LEFT:
|
||||||
keyboard.color.left = val;
|
keyboard.color.left = val;
|
||||||
break;
|
break;
|
||||||
|
@ -535,28 +560,29 @@ static int set_color_region(const char *buffer, size_t size, u32 region)
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mode_validator(const char *val, const struct kernel_param *kp)
|
static int
|
||||||
|
mode_validator(const char *val, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
int mode = 0;
|
int mode = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = kstrtoint(val, 10, &mode);
|
ret = kstrtoint(val, 10, &mode);
|
||||||
if (ret != 0 || mode < 0 || mode > (ARRAY_SIZE(modes) - 1))
|
if (ret != 0 || mode < 0 || mode > (ARRAY_SIZE(modes) - 1)) {
|
||||||
{
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return param_set_int(val, kp);
|
return param_set_int(val, kp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int brightness_validator(const char *val, const struct kernel_param *kp)
|
static int
|
||||||
|
brightness_validator(const char *val, const struct kernel_param *kp)
|
||||||
{
|
{
|
||||||
int brightness = 0;
|
int brightness = 0;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret = kstrtoint(val, 10, &brightness);
|
ret = kstrtoint(val, 10, &brightness);
|
||||||
if (ret != 0 || brightness < BRIGHTNESS_MIN || brightness > BRIGHTNESS_MAX)
|
if (ret != 0 || brightness < BRIGHTNESS_MIN
|
||||||
{
|
|| brightness > BRIGHTNESS_MAX) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,44 +80,63 @@
|
||||||
|
|
||||||
// Sysfs Interface Methods
|
// Sysfs Interface Methods
|
||||||
// Sysfs Interface for the keyboard state (ON / OFF)
|
// Sysfs Interface for the keyboard state (ON / OFF)
|
||||||
static ssize_t show_state_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_state_fs(struct device *child,
|
||||||
static ssize_t set_state_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
struct device_attribute *attr, char *buffer);
|
||||||
|
static ssize_t set_state_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for the color of the left side (Color as hexvalue)
|
// Sysfs Interface for the color of the left side (Color as hexvalue)
|
||||||
static ssize_t show_color_left_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_color_left_fs(struct device *child,
|
||||||
static ssize_t set_color_left_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
struct device_attribute *attr, char *buffer);
|
||||||
|
static ssize_t set_color_left_fs(struct device *child,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for the color of the center (Color as hexvalue)
|
// Sysfs Interface for the color of the center (Color as hexvalue)
|
||||||
static ssize_t show_color_center_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_color_center_fs(struct device *child,
|
||||||
static ssize_t set_color_center_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
struct device_attribute *attr,
|
||||||
|
char *buffer);
|
||||||
|
static ssize_t set_color_center_fs(struct device *child,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for the color of the right side (Color as hexvalue)
|
// Sysfs Interface for the color of the right side (Color as hexvalue)
|
||||||
static ssize_t show_color_right_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_color_right_fs(struct device *child,
|
||||||
static ssize_t set_color_right_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
struct device_attribute *attr, char *buffer);
|
||||||
|
static ssize_t set_color_right_fs(struct device *child,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for the color of the extra region (Color as hexvalue)
|
// Sysfs Interface for the color of the extra region (Color as hexvalue)
|
||||||
static ssize_t show_color_extra_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_color_extra_fs(struct device *child,
|
||||||
static ssize_t set_color_extra_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
struct device_attribute *attr, char *buffer);
|
||||||
|
static ssize_t set_color_extra_fs(struct device *child,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for the keyboard brightness (unsigned int)
|
// Sysfs Interface for the keyboard brightness (unsigned int)
|
||||||
static ssize_t show_brightness_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_brightness_fs(struct device *child,
|
||||||
static ssize_t set_brightness_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
struct device_attribute *attr, char *buffer);
|
||||||
|
static ssize_t set_brightness_fs(struct device *child,
|
||||||
|
struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for the keyboard mode
|
// Sysfs Interface for the keyboard mode
|
||||||
static ssize_t show_mode_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_mode_fs(struct device *child, struct device_attribute *attr,
|
||||||
static ssize_t set_mode_fs(struct device *child, struct device_attribute *attr, const char *buffer, size_t size);
|
char *buffer);
|
||||||
|
static ssize_t set_mode_fs(struct device *child, struct device_attribute *attr,
|
||||||
|
const char *buffer, size_t size);
|
||||||
|
|
||||||
// Sysfs Interface for if the keyboard has extra region
|
// Sysfs Interface for if the keyboard has extra region
|
||||||
static ssize_t show_hasextra_fs(struct device *child, struct device_attribute *attr, char *buffer);
|
static ssize_t show_hasextra_fs(struct device *child,
|
||||||
|
struct device_attribute *attr, char *buffer);
|
||||||
|
|
||||||
// Keyboard struct
|
// Keyboard struct
|
||||||
static struct
|
static struct {
|
||||||
{
|
|
||||||
u8 has_extra;
|
u8 has_extra;
|
||||||
u8 state;
|
u8 state;
|
||||||
|
|
||||||
struct
|
struct {
|
||||||
{
|
|
||||||
u32 left;
|
u32 left;
|
||||||
u32 center;
|
u32 center;
|
||||||
u32 right;
|
u32 right;
|
||||||
|
@ -127,32 +146,26 @@ static struct
|
||||||
u8 brightness;
|
u8 brightness;
|
||||||
u8 mode;
|
u8 mode;
|
||||||
} keyboard = {
|
} keyboard = {
|
||||||
.has_extra = 0,
|
.has_extra = 0,.mode = DEFAULT_MODE,.state = 1,.brightness =
|
||||||
.mode = DEFAULT_MODE,
|
BRIGHTNESS_DEFAULT,.color = {
|
||||||
.state = 1,
|
.left = KB_COLOR_DEFAULT,.center = KB_COLOR_DEFAULT,.right =
|
||||||
.brightness = BRIGHTNESS_DEFAULT,
|
KB_COLOR_DEFAULT,.extra = KB_COLOR_DEFAULT,}
|
||||||
.color = {
|
|
||||||
.left = KB_COLOR_DEFAULT,
|
|
||||||
.center = KB_COLOR_DEFAULT,
|
|
||||||
.right = KB_COLOR_DEFAULT,
|
|
||||||
.extra = KB_COLOR_DEFAULT,
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct
|
static struct {
|
||||||
{
|
|
||||||
u8 key;
|
u8 key;
|
||||||
u32 value;
|
u32 value;
|
||||||
const char *const name;
|
const char *const name;
|
||||||
} modes[] = {
|
} modes[] = {
|
||||||
{ .key = 0, .value = 0 , .name = "CUSTOM" },
|
{
|
||||||
{ .key = 1, .value = 0x1002a000, .name = "BREATHE" },
|
.key = 0,.value = 0,.name = "CUSTOM"}, {
|
||||||
{ .key = 2, .value = 0x33010000, .name = "CYCLE" },
|
.key = 1,.value = 0x1002a000,.name = "BREATHE"}, {
|
||||||
{ .key = 3, .value = 0x80000000, .name = "DANCE" },
|
.key = 2,.value = 0x33010000,.name = "CYCLE"}, {
|
||||||
{ .key = 4, .value = 0xA0000000, .name = "FLASH" },
|
.key = 3,.value = 0x80000000,.name = "DANCE"}, {
|
||||||
{ .key = 5, .value = 0x70000000, .name = "RANDOM_COLOR" },
|
.key = 4,.value = 0xA0000000,.name = "FLASH"}, {
|
||||||
{ .key = 6, .value = 0x90000000, .name = "TEMPO" },
|
.key = 5,.value = 0x70000000,.name = "RANDOM_COLOR"}, {
|
||||||
{ .key = 7, .value = 0xB0000000, .name = "WAVE" }
|
.key = 6,.value = 0x90000000,.name = "TEMPO"}, {
|
||||||
|
.key = 7,.value = 0xB0000000,.name = "WAVE"}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct platform_device *tuxedo_platform_device;
|
struct platform_device *tuxedo_platform_device;
|
||||||
|
@ -178,7 +191,7 @@ static int tuxedo_wmi_resume(struct platform_device *dev);
|
||||||
static int tuxedo_wmi_probe(struct platform_device *dev);
|
static int tuxedo_wmi_probe(struct platform_device *dev);
|
||||||
static void tuxedo_wmi_notify(u32 value, void *context);
|
static void tuxedo_wmi_notify(u32 value, void *context);
|
||||||
|
|
||||||
static int tuxedo_evaluate_method(u32 method_id, u32 arg, u32 *retval);
|
static int tuxedo_evaluate_method(u32 method_id, u32 arg, u32 * retval);
|
||||||
|
|
||||||
static struct platform_driver tuxedo_platform_driver = {
|
static struct platform_driver tuxedo_platform_driver = {
|
||||||
.remove = tuxedo_wmi_remove,
|
.remove = tuxedo_wmi_remove,
|
||||||
|
@ -224,17 +237,20 @@ module_param_cb(mode, ¶m_ops_mode_ops, ¶m_mode, S_IRUSR);
|
||||||
MODULE_PARM_DESC(mode, "Set the mode");
|
MODULE_PARM_DESC(mode, "Set the mode");
|
||||||
|
|
||||||
static ushort param_brightness = BRIGHTNESS_DEFAULT;
|
static ushort param_brightness = BRIGHTNESS_DEFAULT;
|
||||||
module_param_cb(brightness, ¶m_ops_brightness_ops, ¶m_brightness, S_IRUSR);
|
module_param_cb(brightness, ¶m_ops_brightness_ops, ¶m_brightness,
|
||||||
|
S_IRUSR);
|
||||||
MODULE_PARM_DESC(brightness, "Set the Keyboard Brightness");
|
MODULE_PARM_DESC(brightness, "Set the Keyboard Brightness");
|
||||||
|
|
||||||
static bool param_state = true;
|
static bool param_state = true;
|
||||||
module_param_named(state, param_state, bool, S_IRUSR);
|
module_param_named(state, param_state, bool, S_IRUSR);
|
||||||
MODULE_PARM_DESC(state, "Set the State of the Keyboard TRUE = ON | FALSE = OFF");
|
MODULE_PARM_DESC(state,
|
||||||
|
"Set the State of the Keyboard TRUE = ON | FALSE = OFF");
|
||||||
|
|
||||||
// Sysfs device Attributes
|
// Sysfs device Attributes
|
||||||
static DEVICE_ATTR(state, 0644, show_state_fs, set_state_fs);
|
static DEVICE_ATTR(state, 0644, show_state_fs, set_state_fs);
|
||||||
static DEVICE_ATTR(color_left, 0644, show_color_left_fs, set_color_left_fs);
|
static DEVICE_ATTR(color_left, 0644, show_color_left_fs, set_color_left_fs);
|
||||||
static DEVICE_ATTR(color_center, 0644, show_color_center_fs, set_color_center_fs);
|
static DEVICE_ATTR(color_center, 0644, show_color_center_fs,
|
||||||
|
set_color_center_fs);
|
||||||
static DEVICE_ATTR(color_right, 0644, show_color_right_fs, set_color_right_fs);
|
static DEVICE_ATTR(color_right, 0644, show_color_right_fs, set_color_right_fs);
|
||||||
static DEVICE_ATTR(color_extra, 0644, show_color_extra_fs, set_color_extra_fs);
|
static DEVICE_ATTR(color_extra, 0644, show_color_extra_fs, set_color_extra_fs);
|
||||||
static DEVICE_ATTR(brightness, 0644, show_brightness_fs, set_brightness_fs);
|
static DEVICE_ATTR(brightness, 0644, show_brightness_fs, set_brightness_fs);
|
||||||
|
|
Loading…
Reference in a new issue