Tuesday, October 30, 2007

Panasonic Fn Keys in Ubuntu

I lost the functionality of the Fn keys to control brightness and volume after upgrading my Panasonic Toughbook Cf-74 from Ubuntu 7.04 Feisty to 7.10 Gutsy. Turns out that for whatever reason the kernel module which controls the Fn keys is not loading automatically.

To get it working, type the following into a terminal:

sudo modprobe pcc_acpi

That will load the Panasonic acpi driver. And that's it -- your Fn keys should now be working.

To insure that this module loads automatically at next boot, add the above command to /etc/rc.local

9 comments:

Fuzzy said...

Thank you for your helpful patch. I try to make it default at boot time, but when I do gksu gedit /etc/rc.local. The rc.local file says this

-#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

exit 0

Would it still works if I add your command to rc.local?
Also, did you also get the dvd to power off with the button from the integrated dvd device for the Panasonic computer?

Sorry for such a newbie question, but I am new to this ubuntu 7.0 gutsy scene.

rcc said...

fuzzy, the comments in rc.local are there to indicate that the file does nothing by default (or in other words the file lacks content/functionality until you add to it). You are free to add to this file to suit your needs.

So in this case you would add to your rc.local file as described in the original post:

#!/bin/sh
#
# rc.local
#
#

modprobe pcc_acpi

exit 0

Fuzzy said...

Thanks a million! Boy I feel stupid and good thing you answered me because I would have put sudo too LOL. I have a lets note cf-w4. Do you mind if you posted this solution at http://ubuntuforums.org/showthread.php?t=590177?

I will link your blog and give you full credit. I also did modprobe piix - this suppose to fix your dvd to run from 2MB/s to 8MB/s (using "hdparm -t /dev/scd0"). Link and credit below.
http://davesource.com/Solutions/Linux-on-Panasonic-Y5.html

I also get the mouse to work and scroll with the wheel from this site
http://www.39mm.net/~nil/iki/101010/Panasonic_Y5_Linux/

I think I have only 3 more things to get my Ubuntu Gutsy the way I want.
1. Change my laptop to Japanese key board by default b/c mine is a lets note. This is in file xorg.conf.
2. Mount my data partition at boot by default. I know it is the file fstab. I am still researching and looking.
3. Get the integrated DVD to power off with the switch.

Thanks for your help!!!!!!

Anonymous said...

I have a CF-Y5 running Kubuntu Gutsy and my Fn brightness keys doesn't work, I tried running "sudo modprobe pcc_acpi" but nothing happens :(

Anonymous said...

I had this working on my CF-73 until I updated to 8.04 Hardy yesterday. Now I get this:
FATAL: Module pcc_acpi not found.

Time to start some investigation!

Spicemuseum.

Anonymous said...

I've been able to build a working pcc_acpi.ko from the source for my CF-74 and gutsy w/2.6.24 kernel (this should work for hardy 8.04) found here:

http://www.da-cha.jp/files/pcc-acpi-0.9.tar.bz2

and applying the following patch. The patch is the sum of two patches from the source rpm used in opensuse 10.3 basically the make things compatible with the 2.6.23 kernel. (it also works with .24 kernels)


*** pcc_acpi.c 2006-11-21 00:38:41.000000000 -0700
--- pcc_acpi.c.new 2008-05-10 12:58:14.000000000 -0600
***************
*** 168,174 ****
#define METHOD_HKEY_SQTY "SQTY"
#define METHOD_HKEY_SINF "SINF"
#define METHOD_HKEY_SSET "SSET"
- #define HKEY_HID "MAT0012,MAT0013,MAT0018,MAT0019"
#define HKEY_NOTIFY 0x80

/* for brightness control */
--- 168,173 ----
***************
*** 212,224 ****

static int acpi_pcc_hotkey_add(struct acpi_device *device);
static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type);
! static int acpi_pcc_hotkey_resume(struct acpi_device *device, int state);


static struct acpi_driver acpi_pcc_driver = {
.name = ACPI_PCC_DRIVER_NAME,
.class = ACPI_PCC_CLASS,
! .ids = HKEY_HID,
.ops = {
.add = acpi_pcc_hotkey_add,
.remove = acpi_pcc_hotkey_remove,
--- 211,231 ----

static int acpi_pcc_hotkey_add(struct acpi_device *device);
static int acpi_pcc_hotkey_remove(struct acpi_device *device, int type);
! static int acpi_pcc_hotkey_resume(struct acpi_device *device);

+ static const struct acpi_device_id pcc_device_ids[] = {
+ {"MAT0012", 0},
+ {"MAT0013", 0},
+ {"MAT0018", 0},
+ {"MAT0019", 0},
+ {"", 0},
+ };
+ MODULE_DEVICE_TABLE(acpi, pcc_device_ids);

static struct acpi_driver acpi_pcc_driver = {
.name = ACPI_PCC_DRIVER_NAME,
.class = ACPI_PCC_CLASS,
! .ids = pcc_device_ids,
.ops = {
.add = acpi_pcc_hotkey_add,
.remove = acpi_pcc_hotkey_remove,
***************
*** 622,628 ****
case HKEY_NOTIFY:
if (acpi_pcc_hotkey_get_key(hotkey)) {
/* generate event like '"pcc HKEY 00000080 00000084"' when Fn+F4 pressed */
! acpi_bus_generate_event(hotkey->device, event, hotkey->status);
}
acpi_pcc_generete_keyinput(hotkey);
break;
--- 629,635 ----
case HKEY_NOTIFY:
if (acpi_pcc_hotkey_get_key(hotkey)) {
/* generate event like '"pcc HKEY 00000080 00000084"' when Fn+F4 pressed */
! acpi_bus_generate_proc_event(hotkey->device, event, hotkey->status);
}
acpi_pcc_generete_keyinput(hotkey);
break;
***************
*** 834,840 ****
module init
-------------------------------------------------------------------------- */

! static int acpi_pcc_hotkey_resume(struct acpi_device *device, int state)
{
struct acpi_hotkey *hotkey = acpi_driver_data(device);
acpi_status status = AE_OK;
--- 841,847 ----
module init
-------------------------------------------------------------------------- */

! static int acpi_pcc_hotkey_resume(struct acpi_device *device)
{
struct acpi_hotkey *hotkey = acpi_driver_data(device);
acpi_status status = AE_OK;


-Dave

Anonymous said...

Yes, works! Thanks for your efforts.

For the benefit of others, I applied the diffs manually because I wanted to look at the code I was modifying, but you can use 'patch' to apply them automatically (see here http://linux.about.com/od/ubupck_doc/a/ubupg06t05.htm).

Step by step:
Download Hiroshi's code
Then, using a terminal, find the downloaded file and use the following commands.
$ tar xvf pcc-acpi-0.9.tar.bz2
$ cd pcc-acpi-0.9
change the .c file manually or using patch
$ make
$ sudo make install
$ sudo modprobe pcc_acpi

And it should then all be working!

rabbitofdeath said...

Have you had any luck with ubuntu 9.04 in regards to getting the function keys to work?

Brandon Hudson said...

Nice post with awesome points! Can’t wait for the next one.

Dell - Inspiron 15.6" Laptop - 4GB Memory - 500GB Hard Drive

Dell - Inspiron 15.6" Laptop - 4GB Memory - 500GB Hard Drive - Black