klystron34 prepared a led keyboard driver compatible with Clevo P150EM/P170EM Sager NP9150/9170 laptops.
http://forum.notebookreview.com/thr...eta-testers-needed.708796/page-2#post-9094624
I am interested in a driver compatible with Clevo P750ZM Sager NP9752 laptops, particularly as I own one.
I have never written a kernel driver, however, but I am interested to experiment and learn.
-
-
win32asmguy Moderator Moderator
Christoph Jaeger's tuxedo-wmi module works fine with the P750ZM with a couple of simple modifications. I have it cloned in my github here:
https://github.com/fleaplus/tuxedo-wmi
If you are looking to learn more about WMI and how it works in the kernel, this article is a great start:
https://lwn.net/Articles/391230/
There are also lots of good examples in the kernel itself under the drivers/platform/x86 directory. I plan on spending some of my 20% time over the next few weeks to make some improvements to the driver. It would be great if we could get this to the quality level of something that could be accepted into the mainline kernel. It would greatly simplify things for people who own these machines! -
win32asmguy: I compiled your code and loaded the module. Here's what I see:
Code:# insmod tuxedo-wmi.ko # ls -alR /sys/devices/platform/tuxedo_wmi/ /sys/devices/platform/tuxedo_wmi/: total 0 drwxr-xr-x 5 root root 0 May 7 17:55 . drwxr-xr-x 19 root root 0 May 7 17:55 .. lrwxrwxrwx 1 root root 0 May 7 17:55 driver -> ../../../bus/platform/drivers/tuxedo_wmi -rw-r--r-- 1 root root 4096 May 7 17:56 driver_override drwxr-xr-x 3 root root 0 May 7 17:56 input drwxr-xr-x 3 root root 0 May 7 17:56 leds -r--r--r-- 1 root root 4096 May 7 17:56 modalias drwxr-xr-x 2 root root 0 May 7 17:56 power lrwxrwxrwx 1 root root 0 May 7 17:55 subsystem -> ../../../bus/platform -rw-r--r-- 1 root root 4096 May 7 17:56 uevent /sys/devices/platform/tuxedo_wmi/input: total 0 drwxr-xr-x 3 root root 0 May 7 17:56 . drwxr-xr-x 5 root root 0 May 7 17:55 .. drwxr-xr-x 6 root root 0 May 7 17:56 input24 /sys/devices/platform/tuxedo_wmi/input/input24: total 0 drwxr-xr-x 6 root root 0 May 7 17:56 . drwxr-xr-x 3 root root 0 May 7 17:56 .. drwxr-xr-x 2 root root 0 May 7 17:56 capabilities lrwxrwxrwx 1 root root 0 May 7 17:56 device -> ../../../tuxedo_wmi drwxr-xr-x 3 root root 0 May 7 17:56 event16 drwxr-xr-x 2 root root 0 May 7 17:56 id -r--r--r-- 1 root root 4096 May 7 17:56 modalias -r--r--r-- 1 root root 4096 May 7 17:56 name -r--r--r-- 1 root root 4096 May 7 17:56 phys drwxr-xr-x 2 root root 0 May 7 17:56 power -r--r--r-- 1 root root 4096 May 7 17:56 properties lrwxrwxrwx 1 root root 0 May 7 17:55 subsystem -> ../../../../../class/input -rw-r--r-- 1 root root 4096 May 7 17:56 uevent -r--r--r-- 1 root root 4096 May 7 17:56 uniq /sys/devices/platform/tuxedo_wmi/input/input24/capabilities: total 0 drwxr-xr-x 2 root root 0 May 7 17:56 . drwxr-xr-x 6 root root 0 May 7 17:56 .. -r--r--r-- 1 root root 4096 May 7 17:56 abs -r--r--r-- 1 root root 4096 May 7 17:56 ev -r--r--r-- 1 root root 4096 May 7 17:56 ff -r--r--r-- 1 root root 4096 May 7 17:56 key -r--r--r-- 1 root root 4096 May 7 17:56 led -r--r--r-- 1 root root 4096 May 7 17:56 msc -r--r--r-- 1 root root 4096 May 7 17:56 rel -r--r--r-- 1 root root 4096 May 7 17:56 snd -r--r--r-- 1 root root 4096 May 7 17:56 sw /sys/devices/platform/tuxedo_wmi/input/input24/event16: total 0 drwxr-xr-x 3 root root 0 May 7 17:56 . drwxr-xr-x 6 root root 0 May 7 17:56 .. -r--r--r-- 1 root root 4096 May 7 17:56 dev lrwxrwxrwx 1 root root 0 May 7 17:56 device -> ../../input24 drwxr-xr-x 2 root root 0 May 7 17:56 power lrwxrwxrwx 1 root root 0 May 7 17:56 subsystem -> ../../../../../../class/input -rw-r--r-- 1 root root 4096 May 7 17:56 uevent /sys/devices/platform/tuxedo_wmi/input/input24/event16/power: total 0 drwxr-xr-x 2 root root 0 May 7 17:56 . drwxr-xr-x 3 root root 0 May 7 17:56 .. -rw-r--r-- 1 root root 4096 May 7 17:56 async -rw-r--r-- 1 root root 4096 May 7 17:56 autosuspend_delay_ms -rw-r--r-- 1 root root 4096 May 7 17:56 control -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_kids -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_enabled -r--r--r-- 1 root root 4096 May 7 17:56 runtime_status -r--r--r-- 1 root root 4096 May 7 17:56 runtime_suspended_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_usage /sys/devices/platform/tuxedo_wmi/input/input24/id: total 0 drwxr-xr-x 2 root root 0 May 7 17:56 . drwxr-xr-x 6 root root 0 May 7 17:56 .. -r--r--r-- 1 root root 4096 May 7 17:56 bustype -r--r--r-- 1 root root 4096 May 7 17:56 product -r--r--r-- 1 root root 4096 May 7 17:56 vendor -r--r--r-- 1 root root 4096 May 7 17:56 version /sys/devices/platform/tuxedo_wmi/input/input24/power: total 0 drwxr-xr-x 2 root root 0 May 7 17:56 . drwxr-xr-x 6 root root 0 May 7 17:56 .. -rw-r--r-- 1 root root 4096 May 7 17:56 async -rw-r--r-- 1 root root 4096 May 7 17:56 autosuspend_delay_ms -rw-r--r-- 1 root root 4096 May 7 17:56 control -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_kids -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_enabled -r--r--r-- 1 root root 4096 May 7 17:56 runtime_status -r--r--r-- 1 root root 4096 May 7 17:56 runtime_suspended_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_usage /sys/devices/platform/tuxedo_wmi/leds: total 0 drwxr-xr-x 3 root root 0 May 7 17:56 . drwxr-xr-x 5 root root 0 May 7 17:55 .. drwxr-xr-x 3 root root 0 May 7 17:56 tuxedo::airplane /sys/devices/platform/tuxedo_wmi/leds/tuxedo::airplane: total 0 drwxr-xr-x 3 root root 0 May 7 17:56 . drwxr-xr-x 3 root root 0 May 7 17:56 .. -rw-r--r-- 1 root root 4096 May 7 17:56 brightness lrwxrwxrwx 1 root root 0 May 7 17:56 device -> ../../../tuxedo_wmi -r--r--r-- 1 root root 4096 May 7 17:56 max_brightness drwxr-xr-x 2 root root 0 May 7 17:56 power lrwxrwxrwx 1 root root 0 May 7 17:56 subsystem -> ../../../../../class/leds -rw-r--r-- 1 root root 4096 May 7 17:56 trigger -rw-r--r-- 1 root root 4096 May 7 17:56 uevent /sys/devices/platform/tuxedo_wmi/leds/tuxedo::airplane/power: total 0 drwxr-xr-x 2 root root 0 May 7 17:56 . drwxr-xr-x 3 root root 0 May 7 17:56 .. -rw-r--r-- 1 root root 4096 May 7 17:56 async -rw-r--r-- 1 root root 4096 May 7 17:56 autosuspend_delay_ms -rw-r--r-- 1 root root 4096 May 7 17:56 control -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_kids -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_enabled -r--r--r-- 1 root root 4096 May 7 17:56 runtime_status -r--r--r-- 1 root root 4096 May 7 17:56 runtime_suspended_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_usage /sys/devices/platform/tuxedo_wmi/power: total 0 drwxr-xr-x 2 root root 0 May 7 17:56 . drwxr-xr-x 5 root root 0 May 7 17:55 .. -rw-r--r-- 1 root root 4096 May 7 17:56 async -rw-r--r-- 1 root root 4096 May 7 17:56 autosuspend_delay_ms -rw-r--r-- 1 root root 4096 May 7 17:56 control -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_kids -r--r--r-- 1 root root 4096 May 7 17:56 runtime_active_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_enabled -r--r--r-- 1 root root 4096 May 7 17:56 runtime_status -r--r--r-- 1 root root 4096 May 7 17:56 runtime_suspended_time -r--r--r-- 1 root root 4096 May 7 17:56 runtime_usage
Code:# echo 1 > /sys/devices/platform/tuxedo_wmi/leds/tuxedo\:\:airplane/brightness # echo 0 > /sys/devices/platform/tuxedo_wmi/leds/tuxedo\:\:airplane/brightness
Last edited: May 7, 2015 -
Won't compile on 4.1.0-3-generic
Code:make -C /lib/modules/4.1.0-3-generic/build M=/home/user/repositories/tuxedo-wmi/src modules make[1]: Entering directory '/usr/src/linux-headers-4.1.0-3-generic' CC [M] /home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.o In file included from include/linux/thread_info.h:11:0, from ./arch/x86/include/asm/preempt.h:6, from include/linux/preempt.h:18, from include/linux/spinlock.h:50, from include/linux/mmzone.h:7, from include/linux/gfp.h:5, from include/linux/slab.h:14, from include/linux/resource_ext.h:19, from include/linux/acpi.h:30, from /home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.c:23: include/linux/bug.h:33:45: error: negative width in bit-field ‘<anonymous>’ #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/kernel.h:828:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’ BUILD_BUG_ON_ZERO((perms) & 2) + \ ^ include/linux/sysfs.h:92:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ ^ /home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.c:777:2: note: in expansion of macro ‘__ATTR’ __ATTR(kb_bl_state, 0666, kb_bl_state_show, kb_bl_state_store); ^ include/linux/bug.h:33:45: warning: initialization from incompatible pointer type #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/kernel.h:828:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’ BUILD_BUG_ON_ZERO((perms) & 2) + \ ^ include/linux/sysfs.h:92:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ ^ /home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.c:777:2: note: in expansion of macro ‘__ATTR’ __ATTR(kb_bl_state, 0666, kb_bl_state_show, kb_bl_state_store); ^ include/linux/bug.h:33:45: warning: (near initialization for ‘kb_bl_state.store’) #define BUILD_BUG_ON_ZERO(e) (sizeof(struct { int:-!!(e); })) ^ include/linux/kernel.h:828:3: note: in expansion of macro ‘BUILD_BUG_ON_ZERO’ BUILD_BUG_ON_ZERO((perms) & 2) + \ ^ include/linux/sysfs.h:92:12: note: in expansion of macro ‘VERIFY_OCTAL_PERMISSIONS’ .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \ ^ /home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.c:777:2: note: in expansion of macro ‘__ATTR’ __ATTR(kb_bl_state, 0666, kb_bl_state_show, kb_bl_state_store); ^ scripts/Makefile.build:264: recipe for target '/home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.o' failed make[2]: *** [/home/user/repositories/tuxedo-wmi/src/tuxedo-wmi.o] Error 1 Makefile:1395: recipe for target '_module_/home/user/repositories/tuxedo-wmi/src' failed make[1]: *** [_module_/home/user/repositories/tuxedo-wmi/src] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-4.1.0-3-generic' Makefile:6: recipe for target 'all' failed make: *** [all] Error 2
-
If you're still looking to make this happen I found someone who made one that works perfectly and gives you a gui tool to change them too. It will work on a variety of Clevo models including the P750DM, so it should work on the P750ZM. Though you might need to modify a line in the module c file.
Check out https://bitbucket.org/lynthium/clevo-xsm-wmi/overview
his module is based on the tuxedo-wmi module. He did everything in Arch, I did the same thing with small modifications for Fedora. The one change you'll need to make is you need to install and run dmidecode tool to get the model number. On the DM models it's P7xxDM(-G) so it's probably similar. Once you get that and you clone the bitbucket repo, go into the module folder and edit
clevo-xsm-wmi.c you'll need to add your model number to the struct found starting on line 1133
static struct dmi_system_id clevo_xsm_dmi_table[] __initdata =
since you probably aren't going to share your copy of this file with anyone, for simplicity sake you can just edit the line for the 7xxDM(-G) and change it to your model number from the dmidecode tool.
{
.ident = "Clevo P7xxDM(-G)",
.matches = {
DMI_MATCH(DMI_SYS_VENDOR, "Notebook"),
DMI_MATCH(DMI_PRODUCT_NAME, "P7xxDM(-G)"), <------------------------------------------ Change "P7xxDM(-G)" to your model number.
},
.callback = clevo_xsm_dmi_matched,
.driver_data = &kb_full_color_ops,
},
Then follow the instructions for arch or fedora (or if you're running something else modify as necessary) to compile and install the module and utility.
Once the module is installed the keyboard shortcuts should work. The utility gives you a gui to make specifc changes.trikst3r likes this.
Sager NP9752 Special / Clevo P750ZM Linux backlit keyboard driver
Discussion in 'Linux Compatibility and Software' started by Jason Khanlar, Apr 30, 2015.