2010-07-24

Linux on a Fujitsu U810, U820 - keyboard lights

short story: it's working !! - keep reading

Some readers of this blog where still missing this feature, so I engaged the daunting task of finding some time and energy to solve this issue. After 5 hours of googling, reading documentation about acpi, linux kernel, reading c code for the linux kernel drivers, googling for ubuntu file repository source files, ... I found the solution, which is very easy:

=> keyboard lights can be easily controlled by accessing the sysfs <=

Since the sysfs is root-only, I have created a small c program, with automatic compile and install, that makes keyboard-lights accessible for any user.

Installation

1 download the fujitsu-kbdlights-0.1.0.tar.gz to any directory in your computer


2 decompress the package (it will create another directory, fujitsu-kbdlights-0.1.0/)
tar zxvf fujitsu-kbdlights-0.1.0.tar.gz


3 compile and install
cd fujitsu-kbdlights-0.1.0
make
sudo make install


4 and in a command shell, you can type

fujitsu_kbdlights on

fujitsu_kbdlights off

fujitsu_kbdlights toggle

fujitsu_kbdlights


5 if you want, you can bind any of the previous commands to a hot-key using any keyboard setup utility

Enjoy typing at night !!

29 comments:

  1. Can't wait to try this!

    ReplyDelete
  2. successfully downloaded, compiled, and installed...but when i run on/off/toggle at terminal, i get an error:

    "fujitsu_kbdlights::error::parameter not available [/sys/devices/platform/fujitsu-laptop/leds/fujitsu::kblamps/brightness]"

    i'm using jaunty 2.6.28-19-generic...any suggestions???

    ReplyDelete
  3. hi okaidnih,

    I'm using latest ubuntu kernel 2.6.32. For your ubuntu, the fujitsu_laptop kernel module compiled does not provide this functionality.

    So, my recommendation would be to upgrade to karmic, if the external monitor issue is not a big deal for you. Just as a reminder, I'm activelly following the bug to have external monitor work in Karmic as it was in Jaunty..

    ReplyDelete
  4. haha...just as i thought...i was going to try what's posted here about the keyboard lights:
    http://exain.wordpress.com/2008/10/22/howto-fujitsu-u1010-u810-umpc-and-ubuntu-linux-804-hardy-heron/
    but i was afraid i'd screw some of the other modules because this was meant for hardy...and then i saw this latest post and hoped it would work...too soon, i guess...

    i'm too lazy to perform another format (i've gone from karmic to lucid and then back to jaunty) only because my u1010 is working so mighty fine thanks to your blog, except for the buggy bluetooth headset problem in jaunty...

    hoping there'll be a workaround/solution for us (or just me???) jaunty users... :D

    ReplyDelete
  5. hi okaidnih,

    all the required code is in the fujitsu_laptop.c file; you can try to individually download this file and compile it in your computer, and thus, replace the ubuntu-provided fujisu_laptop.k module.

    btw, I'm currenty running lucid (10.04); that's were the external monitor issue is happening, but I think it's gonne be solved in 1-2 weeks now....


    Regards

    ReplyDelete
  6. ok, so i tried doing what was on that website, but then i get 1 warning and 2 errors (same error twice)...the warning was

    "warning: passing argument 4 of ‘acpi_evaluate_integer’ from incompatible pointer type"

    referring to the line

    "status = acpi_evaluate_integer(fujitsu->acpi_handle, "GBLL", NULL, &state);"

    and the error was

    "error: lvalue required as left operand of assignment"

    referring to the line

    "acpi_driver_data(device) = fujitsu;"

    if you need to see more of the code, it's the c file on the website i mentioned...any ideas on how this could be fix??? it sucks that i have little programming experience...

    ReplyDelete
  7. ok, so i scrapped the recompilation of the fujitsu_laptop module and upraded to karmic (i am hesitant to further upgrade to lucid because of your warning in an earlier post) and test if your solution works...i followed your post instructions, but it still gives out the same error as before...it seems the module doesn't still provide the keyboard lights functionality in karmic...hoping for a solution in the near future...

    i'm thankful for the upgrade, though, because now the bluetooth headset's working perfectly...no need to use pulse audio as i did before in jaunty...

    i also like to say that this blog rocks, dude...this blog has always been a reference in my ubuntu implementation on my machine...i commend the research you do and your sharing information to the general internet public...thanks a lot...keep it up, man...

    ReplyDelete
  8. This comment has been removed by the author.

    ReplyDelete
  9. Hi okaidnih,

    I've looked into the karmic fujitsu_laptoc.c code, and the light functionality should be avilable.

    Can you post the result of the following command?

    find /sys -iname 'fujitsu*'

    regards, and thanks for your support !

    ReplyDelete
  10. hi again...

    here is the output to the command i entered:

    /sys/devices/platform/fujitsu-laptop
    /sys/bus/platform/devices/fujitsu-laptop
    /sys/bus/platform/drivers/fujitsu-laptop
    /sys/bus/platform/drivers/fujitsu-laptop/fujitsu-laptop
    /sys/bus/acpi/drivers/Fujitsu laptop FUJ02B1 ACPI brightness driver
    /sys/bus/acpi/drivers/Fujitsu laptop FUJ02E3 ACPI hotkeys driver
    /sys/module/fujitsu_usb_touchscreen
    /sys/module/fujitsu_laptop

    hope it helps...

    ReplyDelete
  11. hi okaidnih,

    this output doesn't seem promising ...

    Can you please also type:

    modinfo fujitsu_laptop

    and post the output?

    ReplyDelete
  12. I forgot,

    and also lsmod | grep fujitsu

    ReplyDelete
  13. ok, so here's the output of the first command:

    filename: /lib/modules/2.6.31-22-generic/kernel/drivers/platform/x86/fujitsu-laptop.ko
    alias: dmi:*:svnFUJITSU:*:pvr:rvnFUJITSU:rnFJNB19C:*:cvrS7020:*
    alias: dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1E6:*:cvrS6420:*
    alias: dmi:*:svnFUJITSUSIEMENS:*:pvr:rvnFUJITSU:rnFJNB1D3:*:cvrS6410:*
    license: GPL
    version: 0.5.0
    description: Fujitsu laptop extras support
    author: Jonathan Woithe, Peter Gruber, Tony Vroon
    srcversion: 03C3DF40C33D8693C4AE15F
    alias: acpi*:FUJ02E3:*
    alias: pnp:dFUJ02E3*
    alias: acpi*:FUJ02B1:*
    alias: pnp:dFUJ02B1*
    alias: acpi*:FUJ02BF:*
    alias: pnp:dFUJ02bf*
    depends:
    vermagic: 2.6.31-22-generic SMP mod_unload modversions 586
    parm: use_alt_lcd_levels:Use alternative interface for lcd_levels (needed for Lifebook s6410). (uint)
    parm: disable_brightness_adjust:Disable brightness adjustment . (uint)

    and here's the output of the second:

    fujitsu_usb_touchscreen 8600 0
    fujitsu_laptop 11940 0

    ReplyDelete
  14. uhm... not finished yet: can you please post the output of:

    lsmod | grep led
    modinfo led_class
    uname -a
    grep CONFIG_LEDS_CLASS /boot/config-2.6.31-22-generic

    ReplyDelete
  15. hi...here are the outputs for the commands:

    lsmod|grep led
    led_class 4096 2 ath5k,sdhci

    modinfo led_class
    filename: /lib/modules/2.6.31-22-generic/kernel/drivers/leds/led-class.ko
    description: LED Class Interface
    license: GPL
    author: John Lenz, Richard Purdie
    srcversion: 82381300DAAD0F4EAE8A3E0
    depends:
    vermagic: 2.6.31-22-generic SMP mod_unload modversions 586

    uname -a
    Linux sayamudfr 2.6.31-22-generic #60-Ubuntu SMP Thu May 27 00:22:23 UTC 2010 i686 GNU/Linux

    grep CONFIG_LEDS_CLASS /boot/config-2.6.31-22-generic
    CONFIG_LEDS_CLASS=m

    ReplyDelete
  16. hi okaidnih,

    now, try this (always as root):

    rmmod fujitsu_laptop
    modprobe led_class
    modprobe fujitsu_laptop
    find /sys -iname 'fujitsu*'

    that's my last chance, so let's hope the output is good!

    ReplyDelete
  17. ran everything as root (sudo):

    /sys/devices/platform/fujitsu-laptop
    /sys/bus/platform/devices/fujitsu-laptop
    /sys/bus/platform/drivers/fujitsu-laptop
    /sys/bus/platform/drivers/fujitsu-laptop/fujitsu-laptop
    /sys/bus/acpi/drivers/Fujitsu laptop FUJ02B1 ACPI brightness driver
    /sys/bus/acpi/drivers/Fujitsu laptop FUJ02E3 ACPI hotkeys driver
    /sys/module/fujitsu_usb_touchscreen
    /sys/module/fujitsu_laptop

    i think it's the same as before...which makes me think that its no good at all...

    ReplyDelete
  18. hi okaidnih,

    I think that your system can activate the leds, but unfortunatelly I cannot tell you why, so the best option now would be to upgrade to Lucid ....


    hth

    ReplyDelete
  19. hmmm...i think i do not have the leds module because there is no /leds folder inside /sys/devices/platform/fujitsu-laptop...i have tried looking for a leds folder, but it's in a different location (/sys/module/led_class/)...also, i have tried looking for fujitsu-laptop.ko, but i can't seem to find it...or am i supposed to even have a file like that in karmic???

    haha, i'm really sorry but i'm reluctant to upgrade to lucid...

    ReplyDelete
  20. in my system, the leds are accessible through /sys/devices/platform/fujitsu-laptop/leds/fujitsu::kblamps

    $ find /sys/ -iname 'fujitsu*'
    /sys/devices/platform/fujitsu-laptop
    /sys/devices/platform/fujitsu-laptop/leds/fujitsu::kblamps
    /sys/bus/platform/devices/fujitsu-laptop
    /sys/bus/platform/drivers/fujitsu-laptop
    /sys/bus/platform/drivers/fujitsu-laptop/fujitsu-laptop
    /sys/bus/acpi/drivers/Fujitsu laptop FUJ02B1 ACPI brightness driver
    /sys/bus/acpi/drivers/Fujitsu laptop FUJ02E3 ACPI hotkeys driver
    /sys/class/leds/fujitsu::kblamps
    /sys/module/fujitsu_usb_touchscreen
    /sys/module/led_class/holders/fujitsu_laptop
    /sys/module/fujitsu_laptop

    ReplyDelete
  21. to find the fujitsu module (which you have, since its loaded) do:

    find /lib/modules/`uname -r`/ -iname 'fujitsu*'

    ReplyDelete
  22. can you post the results of:

    ls -l /sys/devices/platform/fujitsu-laptop

    ReplyDelete
  23. here's the result:

    ls -l /sys/devices/platform/fujitsu-laptop
    total 0
    -r--r--r-- 1 root root 4096 2010-07-31 15:12 brightness_changed
    -r--r--r-- 1 root root 4096 2010-07-31 15:12 dock
    lrwxrwxrwx 1 root root 0 2010-07-31 15:09 driver -> ../../../bus/platform/drivers/fujitsu-laptop
    -rw-r--r-- 1 root root 4096 2010-07-31 15:12 lcd_level
    -r--r--r-- 1 root root 4096 2010-07-31 15:12 lid
    -r--r--r-- 1 root root 4096 2010-07-31 15:12 max_brightness
    -r--r--r-- 1 root root 4096 2010-07-31 15:12 modalias
    drwxr-xr-x 2 root root 0 2010-07-31 15:12 power
    -r--r--r-- 1 root root 4096 2010-07-31 15:12 radios
    lrwxrwxrwx 1 root root 0 2010-07-31 15:09 subsystem -> ../../../bus/platform
    -rw-r--r-- 1 root root 4096 2010-07-31 15:09 uevent

    if you're running karmic, too, couldn't i just copy your fujitsu-laptop.ko given that we're on the same kernel???

    ReplyDelete
  24. here's the output:

    -r--r--r-- 1 root root 4096 2010-08-01 19:23 brightness_changed
    -r--r--r-- 1 root root 4096 2010-08-01 19:23 dock
    lrwxrwxrwx 1 root root 0 2010-08-01 19:19 driver -> ../../../bus/platform/drivers/fujitsu-laptop
    -rw-r--r-- 1 root root 4096 2010-08-01 19:23 lcd_level
    -r--r--r-- 1 root root 4096 2010-08-01 19:23 lid
    -r--r--r-- 1 root root 4096 2010-08-01 19:23 max_brightness
    -r--r--r-- 1 root root 4096 2010-08-01 19:23 modalias
    drwxr-xr-x 2 root root 0 2010-08-01 19:23 power
    -r--r--r-- 1 root root 4096 2010-08-01 19:23 radios
    lrwxrwxrwx 1 root root 0 2010-08-01 19:19 subsystem -> ../../../bus/platform
    -rw-r--r-- 1 root root 4096 2010-08-01 19:19 uevent

    i was thinking, can't i just copy your fujitsu-laptop.ko to my system so that i can load the leds module??? just a thought...thanks again...

    ReplyDelete
  25. I've been following this thread and all my outputs echo okaidnih's output as well his problems with trying to compile the fujitsu_laptop module. I can provide the results of find /lib/modules/`uname -r`/ -iname 'fujitsu*'

    /lib/modules/2.6.28-19-generic/kernel/drivers/misc/fujitsu-laptop.ko
    /lib/modules/2.6.28-19-generic/kernel/drivers/input/touchscreen/fujitsu_ts.ko


    and also the results of ls -l /sys/devices/platform/fujitsu-laptop

    total 0
    -r--r--r-- 1 root root 4096 2010-08-06 11:32 brightness_changed
    lrwxrwxrwx 1 root root 0 2010-08-06 11:32 driver -> ../../../bus/platform/drivers/fujitsu-laptop
    -rw-r--r-- 1 root root 4096 2010-08-06 11:39 lcd_level
    -r--r--r-- 1 root root 4096 2010-08-06 11:39 max_brightness
    -r--r--r-- 1 root root 4096 2010-08-06 11:39 modalias
    drwxr-xr-x 2 root root 0 2010-08-06 11:32 power
    lrwxrwxrwx 1 root root 0 2010-08-06 11:32 subsystem -> ../../../bus/platform
    -rw-r--r-- 1 root root 4096 2010-08-06 11:32 uevent

    This is from a fresh install of Jaunty, before the touchscreen and other mods provided here have been done. Hope this helps! Would love to get the leds working in Jaunty! Tried the led mod on Lucid and everything worked as it should but I had absolutely no success fixing the wireless connectivity problems so I am back to Jaunty.

    ReplyDelete
  26. Hi liliputer,

    I'm glad you can confirm the utility works for 10.04!

    Regarding wifi, i've just realized i'm not using wifi since last year or so .... So I cannot tell you about it; i'll try it and let you know ...

    Regarding the leds working on jaunty or karmic, i think i could try to debug it if any of you let me remote connect to your computer, of course after summer vacations ...

    Any of you willing to let me remote connect with root privileges to compile-install-debug?

    Regards

    ReplyDelete
  27. So, I tried one more time from a clean install of Lucid.

    Through a combination of enabling the backport repositories, installing the newest madwifi driver and blacklisting ath_hal and ath_pci as well as ath5k in the /etc/modprobe.d files, I was able to finally get the wireless up to speed.

    It is very fast now and no longer drops. And the best part is that not only do I have wireless, I also have the keyboard lights thanks to your great work. Using xbindkeys-config I was able to program the / and // for lights and cellwriter.

    ReplyDelete
  28. it works on ubuntu 10.10 thankx i put the shortcut on my keyboard in the system--->preference like ctr+o to off, ctr+l to turn on.

    thanx

    ReplyDelete
  29. Works Great!
    Thanks!

    ReplyDelete