# [HOWTO] Sony Vaio FS series FN keys

## pijalu

EDIT: a easiest way to get it working is available here

After searching a while i found out a way to change brightness... a little tricky but works fine on my FS-115M:

First, download the sony_acpi module from sonypi here

untar it 

```

tar xzvf sony_acpi.tar.gz

```

Copy the following in a file (in the extracted dir, as sony_acpi.patch to keep simple)

```

--- sony_acpi_old/sony_acpi.c   2005-03-01 11:10:33.000000000 +0100

+++ sony_acpi/sony_acpi.c       2005-05-09 19:13:22.000000000 +0200

@@ -80,6 +80,11 @@

                .debug          = 0,

        },

        {

+               .name           = "fnkey",

+               .acpiget        = "GHKE",

+               .debug          = 0,

+       },

+       {

                .name           = "brightness_default",

                .acpiget        = "GPBR",

                .acpiset        = "SPBR",

```

If you copy the patch in the untared sony_acpi dir as sony_acpi.patch (you are a nice person if you follow my advice), patch the sony acpi ext (this will include the functions keys handling using acpi)

```

patch < sony_acpi.patch

```

Compile the patched sony_acpi 

```

make

```

and move it your modules dir and update dep

```

cp sony_acpi.ko /lib/modules/`uname -r`/kernel/drivers/acpi

depmod -a

```

Modprobe it to check if fine

```

modprobe sony_acpi

```

Check in /proc/acpi/sony that you see 3 files

```

muaddib@vaio ~ $ ls /proc/acpi/sony/

brightness  brightness_default  fnkey

```

Add it to your autoload modules (if fine - otherwise check kernel messages)

```

echo "sony_acpi" >> /etc/modules.autoload.d/kernel-2.6

```

Now copy this content to a file called sonyfn.c somewhere

```

#include <stdio.h>

#include <stdlib.h>

#include <errno.h>

#include <unistd.h>

#include <fcntl.h>

#include <sys/ioctl.h>

// sound stuff

#include <linux/soundcard.h>

// keys

#define  FN_F2  1       // cut sound

#define  FN_F3  2       // volume -

#define  FN_F4  4       // volume +

#define  FN_F5  8       // Brightness -

#define  FN_F6  16      // Brightness +

#define  FN_F7  32      // LCD/SCREEN

#define  FN_F10 128     // Zoom in

#define  FN_F12 64      // Suspend

#define  S1_BTN 4096    // S1 custom button

#define  S2_BTN 8192    // S2 custom button

// config hard coded :p

#define  MIXER_DEV      "/dev/mixer"

// SOUND HANDLER

int get_volume(int *value)

{

    int mixer = open(MIXER_DEV, O_RDONLY);

    if (mixer) {

        ioctl(mixer, SOUND_MIXER_READ_VOLUME, value);

        close(mixer);

        return 0;

    }

    else

        return 1;

}

int set_volume(int *value)

{

    int mixer = open(MIXER_DEV, O_RDWR);

    if (mixer) {

        ioctl(mixer, SOUND_MIXER_WRITE_VOLUME, value);

        close(mixer);

        return 0;

    }

    else

        return 1;

}

int volume_up()

{

    int value = 0;

    get_volume(&value);

    if (value < 0x5a5a)

        value += 0x0a0a;

    else

        value = 0x6464;

    set_volume(&value);

    return 0;

}

int volume_down()

{

    int value = 0;

    get_volume(&value);

    if (value > 0x0a0a)

        value -= 0x0a0a;

    else

        value = 0;

    set_volume(&value);

    return 0;

}

int oldvalue;

int mute()

{

    int value;

    get_volume(&value);

    if (value) {

            oldvalue=value;

            value=0;

            set_volume(&value);

    }

    else {

            if (!oldvalue) {

                volume_up();

            }

            else {

                set_volume(&oldvalue);

            }

    }

    return 0;

}

// END OF SOUND

/* Return current brightness of the screen */

int getBrightness() {

        FILE* handle;

        char buffer[2];

        int ret;

        if ((handle=fopen("/proc/acpi/sony/brightness","rb"))==NULL) {

                perror("Error opening /proc/acpi/sony/brightness");

                exit(-1);

        }

        if (fscanf(handle,"%d",&ret)!=1) {

                perror("Error reading /proc/acpi/sony/brightness");

                exit(-1);

        }

        fclose(handle);

        return ret;

}

/* Set the current brightness of the screen */

void setBrightness(int b) {

        FILE* handle;

        char buffer[2];

        // validate values

        if (b>8) {

                b=8;

        }

        else if (b<1) {

                b=1;

        }

        if ((handle=fopen("/proc/acpi/sony/brightness","wb"))==NULL) {

                perror("Error opening /proc/acpi/sony/brightness");

                exit(-1);

        }

        if (fprintf(handle,"%d",b)!=1) {

                perror("Error writing /proc/acpi/sony/brightness");

                exit(-1);

        }

        fclose(handle);

}

// Pool the fnkey status

int getCodes() {

        FILE* handle;

        char buffer[10];

        int ret;

        if ((handle=fopen("/proc/acpi/sony/fnkey","rb"))==NULL) {

                perror("Error opening /proc/acpi/sony/fnkey");

                exit(-1);

        }

        if (fscanf(handle,"%d",&ret)!=1) {

                perror("Error reading /proc/acpi/sony/fnkey");

                exit(-1);

        }

        fclose(handle);

        return ret;

}

// main and loop

int main(void) {

        int key;

        nice(10); // be a nice dirty code

        printf("SonyFN loaded\n");

        while(1) { // loop

                if (key=getCodes()) { // get Fn status

                        if ((key & FN_F5)==FN_F5) { // lower brightness

                                setBrightness(getBrightness()-1);

                        }

                        if ((key & FN_F6)==FN_F6) { // higher brightness

                                setBrightness(getBrightness()+1);

                        }

                        if ((key & FN_F2)==FN_F2){

                                mute();

                        }

                        if ((key & FN_F3)==FN_F3) {

                                volume_down();

                        }

                        if ((key & FN_F4)==FN_F4) {

                                volume_up();

                        }

                        // rest i don't care

                }

                usleep(300000);

        }

        return 0;

}

```

now, compile it and move it to your /usr/bin

```

gcc sonyfn.c -o sonyfn

mv sonyfn /usr/bin

```

As root, launch it (since it's a dirty handler, you need to put it in bg with &  :Wink:  )

```

sonyfn &

```

Check, normally, mute volume, volumes and brightness keys should works...

If works fine, add the handler to your local.start

```

echo "/usr/bin/sonyfn 1>&2 >>/var/log/sonyfn.log &" >>/etc/conf.d/local.start

```

Have funLast edited by pijalu on Thu Sep 15, 2005 5:36 pm; edited 2 times in total

----------

## UB|K

waooo!! i missed this great tip while i was on holidays... so thank you for this, it works great on my vaio (FS115E).

Looking quickly into the code of sonyfn.c showed my that a shortcut was already defined for "fn+F12 --> suspend" but i also noticed:

```
}

                        // rest i don't care

                } 
```

 :Sad: 

so it's not implemented in sonyfn...

Since i don't have any knowledge in programming (not even a litlle), i didn't succeeded to get this working. I've tried something like this:

```
                        if ((key & FN_F12)==FN_F12) {

                                hibernate();

                        } 
```

but compilling fails (cause "hibernate" is an external prog and isn't defined  :Embarassed:  ).

How could i do that?? 

thx in advance

----------

## pijalu

If the program you want to call is, for eg /bin/hibernate , this should to the trick....

if not, change the "/bin/hibernate" to the command/script you want to use 

Just take care, no args...

```

...

if ((key & FN_F12)==FN_F12) {

            if (fork()==0) { 

               if (execv("/bin/hibernate",NULL)==-1) {

                  perror("Cannot run hibernate");   

               }

            }

         }

...

```

If ok/not ok, let me know  :Smile: 

----------

## UB|K

Thank you, it works perfectly and as sonyfn is runned as root, there no need to use sudo to launch the hibernate script.

Here is the correct patch:

```
--- sonyfn.c         2005-06-11 15:09:28.000000000 +0200

+++ sonyfn_susp.c    2005-06-11 15:11:42.000000000 +0200

@@ -192,6 +192,14 @@

                         if ((key & FN_F4)==FN_F4) {

                                 volume_up();

                         }

+

+                       if ((key & FN_F12)==FN_F12) {

+                               if (fork()==0) {

+                                       if (execv("/usr/sbin/hibernate",NULL)==-1) {

+                               perror("Cannot run hibernate");

+                                               }

+                               }

+                       }

                         // rest i don't care

                 }

                 usleep(300000);

```

----------

## pijalu

Cool, thanks for correcting the path  :Smile: 

I guess I really should take a look at the hibernate thing one of this day  :Laughing: 

For the note, you can add the same kind of code to map S1 and S2 buttons to some scripted actions... And as you already knows, they will be runned as root... this means this could be a security issue as well...

To finish, i made a dirty init script for sonyfn, so feel free to "c/p" it 

```

#!/sbin/runscript

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

depend() {

   need localmount

}

checkconfig() {

   if [ ! -e /proc/acpi/sony/fnkey ] ; then

      eerror "Sony key handler not found"

      return 1

   fi

}

start() {

   ebegin "Starting SonyFN key handler"

   /usr/bin/sonyfn 1>&2 >>/var/log/sonyfn.log &

   eend $?

}

stop() {

   ebegin "Stopping SonyFN key handler"

   killall sonyfn 1>&2 >/dev/null

   eend 0

}

```

For eg, save it as sonyfn in /etc/init.d/ and do a 

```

rc-update add sonyfn default

```

You can now remove the call to sonyfn in local.start

Note: if the sonyfn code is not /usr/bin/sonyfn , change the start() and/or stop() path/name to reflect your own installation

----------

## max.bl

Hi guys,

have you got any idea about how to make video out switch (Fn-F7) working ?

I've a vaio fs-115s laptop with nvidia video card.

I'm using sony_acpi kernel module and sonyfn program (thanks for it !!).

----------

## blinksilver

Hey all, I maybe alittle late to post, but I  just bought a Sony S460. Its very close to the FS (pretty much identical except for screen size) and I suspect that this will work. 

When I try to patch the driver it give me an error, and refuse to patch one hunk out of one, I think that the driver has been updated(it is dated the 28 of june), and the patch no longer works. so I tried to hand patch it, just copied and pasted the 5 lines over (took out the +s) then compiled modprobed but " Fnkey" does not show up (the other two do). Could someone pm a patched version of sony_acpi.c?

It would really me out thanks.

----------

## pijalu

I guess the patch problem must be due to a typo made when c/p the patch, but since i don't have any backup of the original sony_acpi.c i used, here come a patch done on the newly d/l sony_acpi.tar.gz

```

--- sony_acpi.c.old     2005-07-24 03:10:14.000000000 +0200

+++ sony_acpi.c 2005-07-24 03:40:03.000000000 +0200

@@ -33,7 +33,7 @@

 #define ACPI_SNC_CLASS         "sony"

 #define ACPI_SNC_HID           "SNY5001"

-#define ACPI_SNC_DRIVER_NAME   "ACPI Sony Notebook Control Driver v0.2"

+#define ACPI_SNC_DRIVER_NAME   "ACPI Sony Notebook Control Driver v0.2-PP"

 #define LOG_PFX                        KERN_WARNING "sony_acpi: "

@@ -88,6 +88,11 @@

                .debug          = 0,

        },

        {

+               .name           = "fnkey",

+               .acpiget        = "GHKE",

+               .debug          = 0,

+       },

+       {

                .name           = "cdpower",

                .acpiget        = "GCDP",

                .acpiset        = "SCDP",

```

Compile and copy to your kernel and give a try to 

```

rmmod sony_acpi

modprobe sony_acpi

```

Now, check if the "patched" version of the modules loaded fine:

```

grep "Sony Notebook Control Driver v0.2-PP" /var/log/messages

```

(This last patch add -PP to the original version, so it should be easier to check if loaded fine)

You should get something like

```

Jul 24 03:41:06 vaio ACPI Sony Notebook Control Driver v0.2-PP successfully installed

```

Hope this will help...

Keep me uptodate about that  :Smile: 

To finish: If not working, did you give a try to the sonypi thing ?

(cf http://popies.net/sonypi/

@max.bl: Sorry, i don't have the time to look for the crt out yet... If i find out how to make it work, i will post it here  :Wink: 

----------

## blinksilver

i dumped linux off because, as is, its not doing me any good, I am too mobile to loss that much battery life, but i have a knoppix cd sitting around, will give it a shot with that.

will report back, but from what i have been reading it does not look good

----------

## pijalu

Hi,

here comes a new sonyfn handler, who should eat less cpu...

This version uses the event interface to check for a possible hit to the Fn key and then try to figure out what happend...

The side effect is a faster handling.... 

Short note: the kernel MUST be compiled with event interface (in Input Device support , check "Event Interface")  [this should be already done for the touchpad thing]

Anyway, check with something like

```

grep "INPUT_EVDEV" /usr/src/linux/.config

```

This should return

```

CONFIG_INPUT_EVDEV=y

```

and a

```

ls /dev/input/

```

should returns (something like this)

```

event0  event1  event2  event3  mice  mouse0  mouse1  mouse2

```

Your keyboard should be event0 , but you can do 

```

sudo cat /dev/input/eventX

```

(with X the nb to check) and if you got "garbage" when hitting keyboard, then you know your keyboard exact eventX

Now, compile the following code (cf first post, just use this code for the handler)

```
#include <stdio.h>

#include <stdlib.h>

#include <errno.h>

#include <unistd.h>

#include <fcntl.h>

#include <sys/ioctl.h>

// input thing

#include <linux/input.h>

// sound stuff

#include <linux/soundcard.h>

// keys 

#define  FN_F2   1   // cut sound

#define  FN_F3  2   // volume -

#define  FN_F4  4   // volume +

#define  FN_F5   8   // Brightness -

#define  FN_F6   16   // Brightness +

#define  FN_F7  32   // LCD/SCREEN

#define  FN_F10 128   // Zoom in

#define    FN_F12 64   // Suspend

#define  S1_BTN 4096   // S1 custom button

#define    S2_BTN 8192   // S2 custom button

#define  FN_INPUT_VALUE   245   // Fn key generate a 245 value

#define  FN_INPUT_TYPE   4   // a 4 type

#define  FN_INPUT_CODE   4   // and a 4 code 

// config hard coded :p

#define  MIXER_DEV   "/dev/mixer"

// SOUND HANDLER

int get_volume(int *value)

{

    int mixer = open(MIXER_DEV, O_RDONLY);

    if (mixer) {

        ioctl(mixer, SOUND_MIXER_READ_VOLUME, value);

        close(mixer);

        return 0;

    }

    else

        return 1;

}

int set_volume(int *value)

{

    int mixer = open(MIXER_DEV, O_RDWR);

    if (mixer) {

        ioctl(mixer, SOUND_MIXER_WRITE_VOLUME, value);

        close(mixer);

        return 0;

    }

    else

        return 1;

}

int volume_up()

{

    int value = 0;

    get_volume(&value);

    if (value < 0x5a5a)

        value += 0x0a0a;

    else

        value = 0x6464;

    set_volume(&value);

    return 0;

}

int volume_down()

{

    int value = 0;

    get_volume(&value);

    if (value > 0x0a0a)

        value -= 0x0a0a;

    else

        value = 0;

    set_volume(&value);

    return 0;

}

int oldvalue;

int mute()

{

    int value;

    

    get_volume(&value);

    

    if (value) {

       oldvalue=value;

       value=0;

       set_volume(&value);

    }

    else {

       if (!oldvalue) {

      volume_up();       

       }

       else {

          set_volume(&oldvalue);

       }

    }

    return 0;

}

// END OF SOUND

/* Return current brightness of the screen */

int getBrightness() {

   FILE* handle;

   char buffer[2];

   int ret;

   

   if ((handle=fopen("/proc/acpi/sony/brightness","rb"))==NULL) {

      perror("Error opening /proc/acpi/sony/brightness");

      exit(-1);

   }

   if (fscanf(handle,"%d",&ret)!=1) {

      perror("Error reading /proc/acpi/sony/brightness");

      exit(-1);

   }

   fclose(handle);

   return ret;

   

}

/* Set the current brightness of the screen */

void setBrightness(int b) {

   FILE* handle;

   char buffer[2];

   // validate values

   if (b>8) { 

      b=8;

   }

   else if (b<1) {

      b=1;

   }

   

   if ((handle=fopen("/proc/acpi/sony/brightness","wb"))==NULL) {

      perror("Error opening /proc/acpi/sony/brightness");

      exit(-1);

   }

   if (fprintf(handle,"%d",b)!=1) {

      perror("Error writing /proc/acpi/sony/brightness");

      exit(-1);

   }

   fclose(handle);

}

// Pool the fnkey status

int getCodes() {

   FILE* handle;

   char buffer[10];

   int ret;

   if ((handle=fopen("/proc/acpi/sony/fnkey","rb"))==NULL) {

      perror("Error opening /proc/acpi/sony/fnkey");

      exit(-1);

   }

   if (fscanf(handle,"%d",&ret)!=1) {

      perror("Error reading /proc/acpi/sony/fnkey");

      exit(-1);

   }

   fclose(handle);

   return ret;   

}

// main and loop

int main(int argc, char **argv) {

   // event interface

        int fd = -1;        /* the file descriptor for the device */

       int i;           /* loop counter */

       size_t read_bytes;  /* how many bytes were read */

       struct input_event ev[64]; /* the events (up to 64 at once) */

      

   /* key code */

   int key;

   /* used if event hit fn */

   int hasSomething;

   

    /* open event interface*/

       if (argc != 2) {

      /* i don't like outputs...

      fprintf(stderr, "Using /dev/input/event0 for input\n");

      fprintf(stderr, "Overide with %s event-device\n", argv[0]);

      */

      if ((fd = open("/dev/input/event0", O_RDONLY)) < 0) {

         perror("event interface open failed");

         exit(1);

          }

       }

   else {   

          if ((fd = open(argv[1], O_RDONLY)) < 0) {

         perror("event interface open failed");

         exit(1);

          }

   }

   nice(10); // be a nice dirty code (less dirty but keep nice)

   

   while(1) { /* loop */

      hasSomething=0; /* nothing yet */

      

      /* read the event interface */

      read_bytes = read(fd, ev, sizeof(struct input_event) * 64);

      

      if (read_bytes < (int) sizeof(struct input_event)) {

             perror("sonyfn: short read");

             exit (1);

      }

      /* Loop for all readed events until we have something interesting.. */

      for (i = 0;! hasSomething && ( i < (int) (read_bytes / sizeof(struct input_event)) ); i++) {

         hasSomething= (ev[i].type == FN_INPUT_TYPE)

               && (ev[i].code == FN_INPUT_CODE)

               && (ev[i].value == FN_INPUT_VALUE);

          }   

      

      /* If we got a FN event, plz do something...*/

      if ( hasSomething && (key=getCodes()) ) { 

         if ((key & FN_F5)==FN_F5) { // lower brightness

            setBrightness(getBrightness()-1);

         }

         if ((key & FN_F6)==FN_F6) { // higher brightness

            setBrightness(getBrightness()+1);

         }

         if ((key & FN_F2)==FN_F2){

            mute();

         }

         if ((key & FN_F3)==FN_F3) {

            volume_down();

         }

         if ((key & FN_F4)==FN_F4) {

            volume_up();

         }

         if ((key & FN_F12)==FN_F12) {

            if (fork()==0) { 

               /* that's my home made script for swsusp

                #!/bin/sh

                sync

                echo "disk" > /sys/power/state

               */

               if (execv("/bin/hibernate",NULL)==-1) {

                  perror("Cannot run hibernate");   

               }

            }

         }

         /* rest i still don't care */      

      }

   }// while

   

   close(fd);

   return 0;

}

```

If your keyboard is /dev/input/event0 then you can just copy this handler on the "old" one , if the event handler is different, then it must me lauch using this synthax

```

sonyfn /dev/input/eventX

```

with X the right number...

Please update the exact call in previous post (init.d thing or local.start)

Have phun

----------

## sound-mind

 *pijalu wrote:*   

> Hi,
> 
> here comes a new sonyfn handler, who should eat less cpu...
> 
> <snip...>
> ...

 

That last version works great pijalu  :Very Happy:    No cpu cycles used unless a user is typing.  Just what the FS users needed!

----------

## sound-mind

Here's a diff against pijalu's latest post to add xosd support.  

Compile:

```

gcc -Wall -o sonyfn sonyfn.c -lxosd -lX11

```

Patch:

```

--- sonyfn.c.old        2005-08-28 18:45:14.168313208 -0400

+++ sonyfn.c    2005-08-29 08:11:37.727686824 -0400

@@ -5,6 +5,11 @@

 #include <fcntl.h>

 #include <sys/ioctl.h>

+// osd stuff

+#include <xosd.h>

+#include <locale.h>

+#include <X11/Xlib.h>

+

 // input thing

 #include <linux/input.h>

@@ -30,6 +35,88 @@

 // config hard coded :p

 #define  MIXER_DEV   "/dev/mixer"

+// The FS series seems to support 8 brightness levels

+#define MAX_BRIGHT 8

+#define MIN_BRIGHT 1

+

+// the volume osd color

+#define OSD_VCOLOR "red"

+// the brightness osd color

+#define OSD_BCOLOR "blue"

+// the osd font... change the 7th position for size

+// or use xfontsel to explore the options

+#define OSD_FONT "-*-*-*-*-*-*-20-*-*-*-*-*-*-*"

+// the length of time the osd is shown

+#define OSD_TIME 3

+

+// volume scaling factor for OSD

+#define OSD_VSCALE 250

+

+// the onscreen display

+static xosd *disp_obj = '\0';

+

+int osd_brightness(int level){

+       // the size of the increment

+       static int inc_size = 100.0 / (MAX_BRIGHT - 1);

+        int retval = 0;

+       int pos;

+

+        retval &= xosd_set_bar_length(disp_obj, 100);

+        retval &= xosd_set_pos(disp_obj, XOSD_bottom);

+        retval &= xosd_set_align(disp_obj, XOSD_center);

+        retval &= xosd_set_shadow_offset(disp_obj, 1);

+        retval &= xosd_set_outline_offset(disp_obj, 1);

+        retval &= xosd_set_vertical_offset(disp_obj, 30);

+        retval &= xosd_set_colour(disp_obj, OSD_BCOLOR);

+        retval &= xosd_set_timeout(disp_obj, OSD_TIME);

+        retval &= xosd_set_font(disp_obj, OSD_FONT);

+

+        if (retval){

+                fprintf(stderr,"Failed setup onscreen display: %s\n", xosd_error);

+        } else {

+               if (level == MAX_BRIGHT){

+                       pos = 100;

+               } else {

+                       pos = level * inc_size - inc_size;

+               }

+                retval = xosd_display(disp_obj, 0, XOSD_slider, pos);

+                retval = xosd_display(disp_obj, 1, XOSD_string, "Brightness");

+                if (retval == -1){

+                        fprintf(stderr,"Failed to display information onscreen: %s\nAre you running X?\n",

+                                       xosd_error);

+                }

+        }

+

+        return 1;

+}

+

+int osd_volume(int level){

+        int retval = 0;

+

+        retval &= xosd_set_bar_length(disp_obj, 100);

+        retval &= xosd_set_pos(disp_obj, XOSD_bottom);

+        retval &= xosd_set_align(disp_obj, XOSD_center);

+        retval &= xosd_set_shadow_offset(disp_obj, 1);

+        retval &= xosd_set_outline_offset(disp_obj, 1);

+        retval &= xosd_set_vertical_offset(disp_obj, 30);

+        retval &= xosd_set_colour(disp_obj, OSD_VCOLOR);

+        retval &= xosd_set_timeout(disp_obj, OSD_TIME);

+        retval &= xosd_set_font(disp_obj, OSD_FONT);

+

+        if (retval){

+                fprintf(stderr,"Failed setup onscreen display: %s\n", xosd_error);

+        } else {

+                retval = xosd_display(disp_obj, 0, XOSD_slider, level / OSD_VSCALE);

+                retval = xosd_display(disp_obj, 1, XOSD_string, "Volume");

+                if (retval == -1){

+                        fprintf(stderr,"Failed to display information onscreen: %s\nAre you running X?\n",

+                                       xosd_error);

+                }

+        }

+

+        return 1;

+}

+

 // SOUND HANDLER

 int get_volume(int *value)

 {

@@ -51,6 +138,7 @@

     if (mixer) {

         ioctl(mixer, SOUND_MIXER_WRITE_VOLUME, value);

         close(mixer);

+       osd_volume(*value);

         return 0;

     }

     else

@@ -117,7 +205,6 @@

 /* Return current brightness of the screen */

 int getBrightness() {

    FILE* handle;

-   char buffer[2];

    int ret;

    if ((handle=fopen("/proc/acpi/sony/brightness","rb"))==NULL) {

@@ -136,14 +223,13 @@

 /* Set the current brightness of the screen */

 void setBrightness(int b) {

    FILE* handle;

-   char buffer[2];

    // validate values

-   if (b>8) {

-      b=8;

+   if (b > MAX_BRIGHT) {

+      b = MAX_BRIGHT;

    }

-   else if (b<1) {

-      b=1;

+   else if (b < MIN_BRIGHT) {

+      b = MIN_BRIGHT;

    }

    if ((handle=fopen("/proc/acpi/sony/brightness","wb"))==NULL) {

@@ -155,12 +241,12 @@

       exit(-1);

    }

    fclose(handle);

+   osd_brightness(b);

 }

 // Pool the fnkey status

 int getCodes() {

    FILE* handle;

-   char buffer[10];

    int ret;

    if ((handle=fopen("/proc/acpi/sony/fnkey","rb"))==NULL) {

       perror("Error opening /proc/acpi/sony/fnkey");

@@ -185,8 +271,16 @@

    /* key code */

    int key;

+

    /* used if event hit fn */

    int hasSomething;

+

+       // initialize the osd

+        disp_obj = xosd_create(2);

+

+       if (setlocale(LC_ALL, "") == NULL || !XSupportsLocale())

+               fprintf(stderr, "Locale not available, expect problems with fonts.\n");

+

     /* open event interface*/

        if (argc != 2) {

@@ -244,7 +338,7 @@

          if ((key & FN_F4)==FN_F4) {

             volume_up();

          }

-         if ((key & FN_F12)==FN_F12) {

+        if ((key & FN_F12)==FN_F12) {

             if (fork()==0) {

                /* that's my home made script for swsusp

                 #!/bin/sh

@@ -255,11 +349,11 @@

                   perror("Cannot run hibernate");

                }

             }

-         }

+         }

          /* rest i still don't care */

       }

    }// while

-

+   xosd_destroy(disp_obj);

    close(fd);

    return 0;

 }

```

You may have to run this as root once you startx depending on your /proc permissions.

Edit: Code update to fix handling of xosd object (leaky threads  :Embarassed: )Last edited by sound-mind on Mon Aug 29, 2005 12:34 pm; edited 1 time in total

----------

## pijalu

Excellent  :Smile: 

This is too sweet  :Smile: 

If you want to use it the easy way [avoid perm problem] (example: if the sonyfn is in /usr/bin)

```

sudo chown root /usr/bin/sonyfn

sudo chmod 4755 /usr/bin/sonyfn

```

This will allows any user to launch the handler as root

(it's a sticky bit - sonyfn then execute as it was launched by root -  take care about it, it can lead to security issue...)

----------

## G2k

When I try to apply the patch I get the following error

```
~/sony_acpi $ patch < fnkey.diff 

patching file sony_acpi.c

Hunk #1 FAILED at 80.

1 out of 1 hunk FAILED -- saving rejects to file sony_acpi.c.rej
```

How can I fix this?

----------

## pijalu

Hum, just to be sure, reextract the sony_acpi.tar.gz content and give a try to

```

patch -l --dry-run < fnkey.diff

```

(this try the patch without really applying it)

If it don't complain, then

```

patch -l < fnkey.diff

```

Otherwise, pm your email/or send me email and i will send it to you asap

Tip: the -l option inform patch to ignore white space during the procedure

----------

## G2k

k that worked, thanks

EDIT:

new problem. Modprobing tells me

```
FATAL: Module sony_acpi not found.
```

although the sony_acpi.ko is in /lib/modules/2.6.12-gentoo-r9/kernel/drivers/acpi/ where `uname -r` is 2.6.12-gentoo-r9. I have module loading enabled in my kernel.

----------

## sound-mind

I just updated the patch above.  I mishandled the threaded xosd object and ended up leaking threads all over the floor  :Embarassed: 

Now you should see a total of 3 processes reported by ps.  Two of these are really just GUI handling threads used by the xosd libs that should sleep most of

the time.  These could be avoided by creating and destroying the xosd object at each fnkey press.  It is a tradeoff, two lightweight threads sleeping in the background vs. dynamically creating and destroying the threads each time a fnkey is pressed.

G2k: Have you run depmod -a?

----------

## pijalu

For me, 2 sleeping treads are way better than the overhead of recreating objects  :Smile: 

FYI: I totally forgot the depmod thing in the very first post...my fault...I just corrected that now...

Btw G2k, if still troubles, give a try to

```

insmod /path/to/sony_acpi.ko

```

This should force the load  :Wink: 

----------

## G2k

gah!

```
 gcc -Wall -o sonyfn sonyfn.c -lxosd -lX11

sonyfn.c:9:18: xosd.h: No such file or directory

sonyfn.c:56: error: syntax error before '*' token

sonyfn.c:56: warning: type defaults to `int' in declaration of `disp_obj'

sonyfn.c:56: warning: data definition has no type or storage class

sonyfn.c: In function `osd_brightness':

sonyfn.c:64: warning: implicit declaration of function `xosd_set_bar_length'

sonyfn.c:65: warning: implicit declaration of function `xosd_set_pos'

sonyfn.c:65: error: `XOSD_bottom' undeclared (first use in this function)

sonyfn.c:65: error: (Each undeclared identifier is reported only once

sonyfn.c:65: error: for each function it appears in.)

sonyfn.c:66: warning: implicit declaration of function `xosd_set_align'

sonyfn.c:66: error: `XOSD_center' undeclared (first use in this function)

sonyfn.c:67: warning: implicit declaration of function `xosd_set_shadow_offset'

sonyfn.c:68: warning: implicit declaration of function `xosd_set_outline_offset'

sonyfn.c:69: warning: implicit declaration of function `xosd_set_vertical_offset'

sonyfn.c:70: warning: implicit declaration of function `xosd_set_colour'

sonyfn.c:71: warning: implicit declaration of function `xosd_set_timeout'

sonyfn.c:72: warning: implicit declaration of function `xosd_set_font'

sonyfn.c:75: error: `xosd_error' undeclared (first use in this function)

sonyfn.c:82: warning: implicit declaration of function `xosd_display'

sonyfn.c:82: error: `XOSD_slider' undeclared (first use in this function)

sonyfn.c:83: error: `XOSD_string' undeclared (first use in this function)

sonyfn.c: In function `osd_volume':

sonyfn.c:97: error: `XOSD_bottom' undeclared (first use in this function)

sonyfn.c:98: error: `XOSD_center' undeclared (first use in this function)

sonyfn.c:107: error: `xosd_error' undeclared (first use in this function)

sonyfn.c:109: error: `XOSD_slider' undeclared (first use in this function)

sonyfn.c:110: error: `XOSD_string' undeclared (first use in this function)

sonyfn.c: In function `main':

sonyfn.c:279: warning: implicit declaration of function `xosd_create'

sonyfn.c:279: warning: assignment makes pointer from integer without a cast

sonyfn.c:356: warning: implicit declaration of function `xosd_destroy'
```

wouldn't it be easier if all the steps were in the right order on the first post on this page?? I'm not good at this kind of stuff  :Crying or Very sad: 

----------

## sound-mind

G2k: emerge xosd

I'll try to make an ebuild when I get some free time.

----------

## pijalu

 *G2k wrote:*   

> gah!

 

```

emerge xosd

```

should help you...

edit: to slow

Actually, yap, but the things is i like the incremental way to do it... there is still one trade off... Or you use the nice X one or the other one with the init.d - but both of them is a not go...

(...I guess, didn't try this  :Wink: ...) 

Actually i think making a nice ebuild should be the thing to do and host it somewhere... 

(and use nice #IFDEF thing to allows with/without xosd on one src...)

If someone is interested go ahead... I am quite in a buzz now... if not, will do that next week...  :Wink: 

edit: LOL

----------

## sound-mind

 *pijalu wrote:*   

> 
> 
> Actually, yap, but the things is i like the incremental way to do it... there is still one trade off... Or you use the nice X one or the other one with the init.d - but both of them is a not go...
> 
> (...I guess, didn't try this ...)
> ...

 

Yup... I thought wrapping the functions and their calls in IFDEF's but didn't want to complicate things.  I guess I could update this and make an ebuild...  So whoever has free time first  :Wink: 

Actually I'll try to post an IFDEF'd wrapped version later today and you can just compile it with -DUSE_XOSD to make it easy.

----------

## pijalu

 *sound-mind wrote:*   

> 
> 
> Yup... I thought wrapping the functions and their calls in IFDEF's but didn't want to complicate things.  I guess I could update this and make an ebuild...  So whoever has free time first 
> 
> Actually I'll try to post an IFDEF'd wrapped version later today and you can just compile it with -DUSE_XOSD to make it easy.

 

Ho, for the ifdef i thought the same way as you  :Smile: , just telling that for the ebuild...Currently, Users decide a super ifdef : using patch or not using patch...  :Laughing: 

Don't bother with it, it will be a job for the ebuilder  :Wink: 

----------

## G2k

lol...uhm...I'm lazy. do you guys mind if I sit here and just wait for an e-build?  :Razz: 

----------

## pijalu

 :Laughing: 

----------

## harryx

I have a Sony PCG K15. The sony_acpi module together with 

  sonyfn does not work as expected. The reason is that on my

  laptop it seems not possible to read out the current screen 

  brightness. Reading from the file proc/acpi/sony/brightness

  always returns the same value as reading from

  /proc/acpi/sony/brightness_default/  (kind of strange)

  I changed sonyfn so that changing the screen 

  brightness always writes to brightness and brightness_default.

  Then everything works fine. Thanks for the program.

----------

## pijalu

yep, I already notice this behavior an a sony laptop of a friends (i just don't remember the version) 

The most funny thing is actually the laptop use "default" value but need a write in brigthness to actually use it... 

Anyway, thx for info and model, and confirmation of this "funny" behavior  :Smile: 

----------

## Deltaflyer

Hi,

I tried your sony_acpi Patch on my Vaio VGN-A115M, but the patched Module don't seems to creat a fnkey file in /proc/acpi/sony.

```

Drone sony # pwd

/proc/acpi/sony

Drone sony # ls

brightness  brightness_default

```

Do you think that my Notebook is just incompatible? ( i hope not  :Wink:  )

or is it only some pebkac on my side?  :Wink: 

----------

## dextermagnific

Tha patch didn't work for you as for me.

I just added the entries that are in the patch manually in sony_acpi.c (added those entries for the fnkeys)

I have a question : did anyone succeeded in making the fn+f7 (tv-out) keys working ?

Thanks

----------

## pijalu

 *dextermagnific wrote:*   

> Tha patch didn't work for you as for me.
> 
> I just added the entries that are in the patch manually in sony_acpi.c (added those entries for the fnkeys)
> 
> I have a question : did anyone succeeded in making the fn+f7 (tv-out) keys working ?
> ...

 

I didn't succeed to make it work on my machine, plugging/unplugging an external screen generate an acpi event but that all i see so far... the strange thing is the nvidia-settings don't see the additional screen aswell.... the only way i found was to power the laptop with the screen plugged... I still have to play with other screen (the one i use is a really pretty old one...)

----------

## pijalu

 *Deltaflyer wrote:*   

> Hi,
> 
> I tried your sony_acpi Patch on my Vaio VGN-A115M, but the patched Module don't seems to creat a fnkey file in /proc/acpi/sony.
> 
> ```
> ...

 

Easy way to check

```

sudo strings /proc/acpi/dsdt | grep GHKE

```

should return GHKE

if not: not supported, 

if yes, are you sure you are using the patched version ?

Give a try at the second patch for sony_acpi, this one added a PP, and you should see a 0.2-PP in the syslog

and try 

```

rmmod sony_acpi

depmod -a

modprobe sony_acpi

```

and check again  :Smile: 

----------

## dextermagnific

so turning on the computer with an external screen plugged makes the computer display on that screen ?

if so, this is good news for me. I can make my presentation without having to find another laptop that *works* grrrrrrrrrrrr.....

Thanks, i'll try that.

----------

## pijalu

 *dextermagnific wrote:*   

> so turning on the computer with an external screen plugged makes the computer display on that screen ?
> 
> if so, this is good news for me. I can make my presentation without having to find another laptop that *works* grrrrrrrrrrrr.....
> 
> Thanks, i'll try that.

 

at least on mine, and work as a dual (crt+lcd)

----------

## Deltaflyer

 *dextermagnific wrote:*   

> so turning on the computer with an external screen plugged makes the computer display on that screen ?
> 
> if so, this is good news for me. I can make my presentation without having to find another laptop that *works* grrrrrrrrrrrr.....
> 
> Thanks, i'll try that.

 

I think it should also work with only restarting the Xserver.

So you only have to plug in the Monitor and  press crtl+alt+backspace. (you should have configured the 2nd Moinor in your config  :Wink:  )

At least that worked for me.

----------

## Deltaflyer

 *pijalu wrote:*   

> 
> 
> Easy way to check
> 
> ```
> ...

 

```

Drone ~ # strings /proc/acpi/dsdt

Drone ~ #  

```

could it be, that this returns nothing? 

```

Drone ~ # rmmod sony_acpi

Drone ~ # lsmod

Module                  Size  Used by

Drone ~ # depmod -a

Drone ~ # modprobe sony_acpi

Drone ~ # dmesg | grep -i sony

ACPI Sony Notebook Control Driver v0.2-PP successfully removed

ACPI Sony Notebook Control Driver v0.2-PP successfully installed

Drone ~ #       

```

and again "strings /proc/acpi/dsdt" returns nothing.

 :Sad: 

----------

## pijalu

 *Deltaflyer wrote:*   

> 
> 
>  "strings /proc/acpi/dsdt" returns nothing.
> 
> 

 

if the strings don't report you the GHKE, it just means your DSDT will not work with this how-to, maybe give a shot to the patched sony_pi

(see https://forums.gentoo.org/viewtopic-t-361872-highlight-sony.html)

----------

## pijalu

 *Deltaflyer wrote:*   

>  *dextermagnific wrote:*   so turning on the computer with an external screen plugged makes the computer display on that screen ?
> 
> if so, this is good news for me. I can make my presentation without having to find another laptop that *works* grrrrrrrrrrrr.....
> 
> Thanks, i'll try that. 
> ...

 

hihi I didn't try that yet... hmmm... that looks interesting... 

Will look at that someday  :Wink: 

Thx for sharing the info

----------

## Deltaflyer

 *pijalu wrote:*   

>  *Deltaflyer wrote:*   
> 
>  "strings /proc/acpi/dsdt" returns nothing.
> 
>  
> ...

 

hrm,

I'm wondering, why this even don't return GPBR or SPBR.

I have /proc/acpi/sony/brightness and /proc/acpi/sony/brightness_default and they're working. So GPBR or SPBR should be present?!

(I hope thats not too much OT  :Smile:  )

----------

## dextermagnific

About the tv-out : 

yes it does work by restarting the X server.

The fact is that the monitor must be plugged before the X server starts. If it is already started, you must restart it.

This is very good news for me. At last I can show my presentation on my own laptop.

F**k non-standard hardware with no specifications !!!

You know i wrote to Sony to get some specifications about the fn keys, here is what i got :

Dear Mr xyz,

Unfortunately we cannot provide you with Linux drivers. Sony doesn't provide support for systems other than the one preinstalled.

This forum was very helpful for me. In 2 days,  my fn keys worked and i got the tv-out.

There is still a pb : did anyone succeeded in hibernate ? (echo 4 > /proc/acpi/sleep or echi disk > /sys/power/state)

after freezing the cpu and stopping tasks, the monitor becomes black but the computer doesn't shut down

Thanks

----------

## pijalu

 *dextermagnific wrote:*   

> 
> 
> You know i wrote to Sony to get some specifications about the fn keys, here is what i got :
> 
> Dear Mr xyz,
> ...

 

hmm, most of the constructor just don't want to bother with other systems than windows... it's not just Sony... most of them behave the same... we are not YET a good market (and the PS3 on linux... that's quite funny...)

I really don't get why the IT field is so complicated... One day I writed to Phillips to get the electrical schema of a dish washer.. and i got it the day after without any troubles... 

 *Quote:*   

> 
> 
> There is still a pb : did anyone succeeded in hibernate ? (echo 4 > /proc/acpi/sleep or echi disk > /sys/power/state)
> 
> after freezing the cpu and stopping tasks, the monitor becomes black but the computer doesn't shut down
> ...

 

I succeed to hibernate without problem if i am NOT on battery (using swsup) ... On battery it just hangs after the screen blanking... but i didn't go really further, still hold quite important informations on the HD (and honestly, I never use my laptop without power supply...)

The problem seems generic with sony laptops  :Sad:  (from what i see)

----------

## pijalu

 *Deltaflyer wrote:*   

> 
> 
> hrm,
> 
> I'm wondering, why this even don't return GPBR or SPBR.
> ...

 

Yup, it should... send me your dsdt by mail and i will confirm/infirm  :Smile: 

----------

## G2k

hey guys I was wondering if you know a way to have the system shutdown when the battery is low. Right now the only way I can know my battery status is through torsmo, but it would be nice to have the computer shutdown if I'm not around to do it myself. Any success on the suspending to RAM issue?

Also, will an ebuild for this ever come out  :Surprised:  cus I've been too lazy to attempt getting the FN keys to work properly.

thanks

----------

## pijalu

 *G2k wrote:*   

> hey guys I was wondering if you know a way to have the system shutdown when the battery is low. Right now the only way I can know my battery status is through torsmo, but it would be nice to have the computer shutdown if I'm not around to do it myself. Any success on the suspending to RAM issue?
> 
> 

 

* The shutdown on low battery: Take a look at acpid, should be doable (gnome/kde give me warn) - didn't try.... i hate this 'feature'... and i am always around my machine  :Wink: 

Take a look at 

```

cat /proc/acpi/battery/BAT0/state

cat /proc/acpi/battery/BAT0/info

```

this give you needed infos 

* Suspend to RAM/HD : nope... and honestly, i am not a "battery" guy anyway... the battery is not even in my laptop... 

 *G2k wrote:*   

> 
> 
> Also, will an ebuild for this ever come out  cus I've been too lazy to attempt getting the FN keys to work properly.
> 
> thanks

 

No ebuild yet, didn't find time to do it... but maybe give a shoot at http://developer.berlios.de/project/showfiles.php?group_id=4604

I put there a project for it with sound-mind, no docs (yet)  in the tar ball but here they comes:

Gentooist: new overlay ebuilds at http://download.berlios.de/fsfn/fsfn_overlay.tar.bz2

* untar this in your overlay dir 

* emerge fsfn

* add sony_acpi to your modules autoload list

* jump to the rc-update part  :Smile: 

Install (if needed) the patched sony_acpi

and then 

```

wget http://download.berlios.de/fsfn/sony_acpi.tar.gz

tar zxvf sony_acpi.tar.gz

cd sony_acpi

make && sudo make install

```

Check if the module fit your kernel

```

modprobe sony_acpi

ls /proc/acpi/sony

```

You should see

```

brightness  brightness_default  fnkey

```

If ok, add sony_acpi to your autoloaded modules

```

echo sony_acpi >> /etc/modules.autoload.d/kernel-2.6

```

Install xosd (if needed)

```

emerge xosd

```

Install the new sonyfn (called fsfn - didn't want to put sony in the short name... good machines... bad PR)

```

wget http://download.berlios.de/fsfn/fsfn-1.0.tar.gz

tar zxvf fsfn-1.0.tar.gz

cd fsfn-1.0

./configure && make && sudo make install

```

If you want a init.d script, you can copy the one included in the gentoo dir or get it using svn

```

cd /etc/init.d/

sudo wget "http://svn.berlios.de/viewcvs/*checkout*/fsfn/trunk/fsfn/gentoo/fsfn?rev=1" -O fsfn

chmod +x fsfn

```

Note: For debian/fedora based people, you can find a initscript in the debian/fedora sub dir or on svn:  

debian(thanks go to messenjer for this one) / fedora 

Autostart the handler (remove previous version manually from local or from previously posted init script)

```

rc-update add fsfn default

```

Some infos: 

This will launch a deamon to handle the key (like sonyfn) , should be run as root

```

fsfn

```

or (best solution )

```

/etc/init.d/fsfn start 

```

If you use X , add to kde/gnome/xsession the call to 

```

/usr/local/bin/fsfn -o

```

This is normally give you nice visual feedback about volume/brightness thanks to sound-mind. This can be run as a normal user

More infos: rtfm !

```

man fsfn

```

==> Informations on fsfn

```

man 5 fsfn

```

==> Informations of /etc/fsfn.conf (configuration for fsfn)

Hope it helps

Btw, any contrib welcome  :Wink: ...

EDIT: 

* 2005-12-13 : Updated for ver 1.0 [ new version - man - gentoo overlay]

* 2005-11-25 :  Updated for ver 0.3 [deamonize corrected + debian initscript included]

* 2005-11-25 :  Updated for ver 0.3-r1 [more details errors messages]Last edited by pijalu on Tue Dec 13, 2005 7:15 pm; edited 7 times in total

----------

## G2k

everything went smoothly until

```
# pwd

/etc/init.d

# rc-update add fsfn default

 * fsfn not executable; skipping

# /etc/init.d/fsfn start

-bash: /etc/init.d/fsfn: Permission denied
```

  :Question: 

----------

## pijalu

 *G2k wrote:*   

> everything went smoothly until
> 
> ```
> # pwd
> 
> ...

 

sorry, a 

```

chmod +x /etc/init.d/fsfn 

```

should help (corrected previous post, thx)

----------

## G2k

```
/etc/init.d/fsfn start

 * Caching service dependencies ...                                       [ ok ]

 * Starting fsfn key handler ...

Failed to generate key: No such file or directory                         [ ok ]
```

I love it how there's an [ ok ] there anyways   :Smile: 

and one last thing: where exactly do I have to add the line /usr/local/bin/fsfn -o ?

thanks for your time

----------

## pijalu

 *G2k wrote:*   

> 
> 
> ```
> /etc/init.d/fsfn start
> 
> ...

 

the error is not good, won't work... it's when the deamon try generate a key for /proc/acpi/sony

Before launching, do a

```

modprobe sony_acpi

```

then relaunch

```

/etc/init.d/fsfn restart

```

if it don't complain, do

```

echo sony_acpi >> /etc/modules.autoload.d/kernel-2.6

```

to load sony_acpi directly

----------

## pijalu

To add fsfn at start of your X session, in a clean and easy way:

* gnome

Desktop Menu - Preference - Sessions, then Startup program tab, choose add

enter for Startup Command : "/usr/local/bin/fsfn -o"

and set Order to 99 (last one to start)

* kde

copy this code in a file called fsfn in ~/.kde/Autostart/fsfn

```

#!/bin/sh

/usr/local/bin/fsfn -o

```

and then do 

```

chmod +x of ~/.kde/Autostart/fsfn 

```

then you should have a nice output of brightness/sound changes

----------

## G2k

uh...I think I got everything to run properly cus I didn't get any other errors. However the Fn key is not working   :Confused:  do I have to reboot or something? I know...it's not windows...but still I tried restarting the service and it still doesn't work (and again, I get no errors). I also ran fsfn -o as a background process...still nothing.

----------

## pijalu

 *G2k wrote:*   

> uh...I think I got everything to run properly cus I didn't get any other errors. However the Fn key is not working   do I have to reboot or something? I know...it's not windows...but still I tried restarting the service and it still doesn't work (and again, I get no errors). I also ran fsfn -o as a background process...still nothing.

 

reboot should not be needed...

Let's do some research

As root

```

killall fsfn

rmmod sony_acpi

dmesg -c

modprobe sony_acpi

ls /proc/acpi/sony

ls /dev/input

fsfn -n

(try a few hit)

dmesg

```

This will start fsfn in a "non background" mode, to check what's going on..

If not working, send the result of the 2 ls and the last dmesg

----------

## G2k

```
# ls /proc/acpi/sony/

brightness  brightness_default  fnkey

# ls /dev/input/

event0  event2  event4  js1  js3   mouse0  mouse2

event1  event3  js0     js2  mice  mouse1

# fsfn -n

# dmesg 

ACPI Sony Notebook Control Driver v0.2-PP successfully installed

atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.
```

----------

## G2k

Rebooted and still doesn't work.

I tried running xev. When I click a key and then release it two messages appear respectively. However, this doesn't work at all with the Fn key, it's as if I'm not pressing anything. Could it be that I have to change keyboard layout or something? I don't think it's something missing in the kernel.

----------

## pijalu

 *G2k wrote:*   

> Rebooted and still doesn't work.
> 
> I tried running xev. When I click a key and then release it two messages appear respectively. However, this doesn't work at all with the Fn key, it's as if I'm not pressing anything. Could it be that I have to change keyboard layout or something? I don't think it's something missing in the kernel.

 

Nope, everything seems fine as far as i can see... i guess a last info can be to check keyboard input device

```

cat /dev/input/event0

```

and try pressing the fn key, do you see "garbage" coming out ? if not, can you do the same with all event until you find the one who give garbage ?

And in your bios, what's the hotkey event type ? (on mine, type 1 - as default factory)

----------

## G2k

basically every key returned "garbage" except for the Fn key...is this normal behavior?

How can I check the BIOS hotkey event type?

----------

## pijalu

 *G2k wrote:*   

> basically every key returned "garbage" except for the Fn key...is this normal behavior?
> 
> How can I check the BIOS hotkey event type?

 

sorry, was unclear, It's should return garbage when you do a Fn+action key

For the bios, when machine boots you should get an option to enter bios (F2 if i remember well)

[otw]

You never sleep ?  :Wink: 

[/otw]

----------

## G2k

 *pijalu wrote:*   

> [otw]
> 
> You never sleep ? 
> 
> [/otw]

 hehe. Nope  :Wink: 

cat /dev/input/event0 doesn't work even with Fn+combination.

The Hotkey thing in the BIOS was Type 1

EDIT:

the code you sent me returned nothing.

----------

## pijalu

humm, try the code i pm-ed you, and gimme results  :Wink: 

edit: start to smell strange... anyway, try the "last" hope check... and did the code return nothing for all eventX ?

----------

## pijalu

Ok, following 

```

cat /proc/bus/input/devices 

```

your keyboard is mapped as event2

cf

```

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41

N: Name="AT Translated Set 2 keyboard"

P: Phys=isa0060/serio0/input0

H: Handlers=kbd event2

B: EV=120013

B: KEY=4 2000000 3802078 f840d001 f2ffffdf ffefffff ffffffff fffffffe

B: MSC=10

B: LED=7 

```

So, can you see if

```

fsfn -n -d /dev/input/event2

```

Does it do the trick ? (if not, run pm code on this device)

----------

## G2k

that did the trick! but am I supposed to get an on-screen display giving me information on how bright it is or how loud the volume is? I emerged xosd already.

EDIT:

also, how can I make it so that there's a default brightness and default sound? Is the last used the default? Thanks so much.

----------

## pijalu

 *G2k wrote:*   

> that did the trick! but am I supposed to get an on-screen display giving me information on how bright it is or how loud the volume is? I emerged xosd already.
> 
> EDIT:
> 
> also, how can I make it so that there's a default brightness and default sound? Is the last used the default? Thanks so much.

 

ok, good news, now change the /etc/init.d/fsfn with

```

#!/sbin/runscript

# Copyright 1999-2005 Gentoo Foundation

# Distributed under the terms of the GNU General Public License v2

# $Header: $

depend() {

   need localmount

}

checkconfig() {

   if [ ! -e /proc/acpi/sony/fnkey ] ; then

      eerror "Sony acpi key handler not found"

      return 1

   fi

}

start() {

   ebegin "Starting fsfn key handler"

   nice -n 10 /usr/local/bin/fsfn -d /dev/input/event2

   eend $?

}

stop() {

   ebegin "Stopping fsfn key handler"

   start-stop-daemon --stop --pidfile /var/run/fsfn.pid

   eend $?

}

```

Now, for xosd you have to add to your x session startup the "fsfn -o"  (see previous post for it - should be run after fsfn is loaded)

* Default sound level will be the last sound level, and should be done by alsa (when reading/saving current values)

* default brightness: do a

```

echo 5 > /proc/acpi/sony/brightness_default

```

for a level 5 default brightness (value are from 1 to 8 )

(Actually i plan to change the code of the handler to change the default to the last set value, this will be (IMHO) more userfriendly and will, as a side effect, made some non-fs serie able to use the fsfn without patching...

----------

## G2k

thanks so much, it all works well now!

----------

## axterics

I have a FS115S. I don't know why but my keyboard is mapped differently to G2k and is on event0 (I've checked with cat /proc/bus/input/devices, on event2 I've the mouse).

The brigthness FNkey work, but not the 3 audio FNkey.. the dmesg is equal to the last of G2k...

I've the init script of the berlios site.. Maybe I've to upgrade to the last post here in the forum?

----------

## pijalu

 *axterics wrote:*   

> I have a FS115S. I don't know why but my keyboard is mapped differently to G2k and is on event0 (I've checked with cat /proc/bus/input/devices, on event2 I've the mouse).
> 
> The brigthness FNkey work, but not the 3 audio FNkey.. the dmesg is equal to the last of G2k...
> 
> I've the init script of the berlios site.. Maybe I've to upgrade to the last post here in the forum?

 

My laptop got the keyboard as event0 as well... it's not a big deal, for you fsfn should work as a default (the init posted sooner is a g2k version only or for people who go another input for keyboard)

For the dmesg, just normal, since the fn+something generate a keycode unknow by the kernel

if you want to "remove" these messages, you can do something like 

```

setkeycodes e075 220

```

(with last parameters any unused keycode), this will stop the kernel to issue warning

For the sound, you should have OSS enabled, since the fsfn use the OSS device mixer, so 

```

ls -la /dev/mixer

```

should return something like

```

lrwxrwxrwx  1 root root 11 Sep 15 12:38 /dev/mixer -> sound/mixer

```

and

```

lsmod | grep oss

```

should return something like

```

snd_pcm_oss            48864  0

snd_mixer_oss          17216  2 snd_pcm_oss

snd_seq_oss            33600  0

snd_seq_midi_event      5760  1 snd_seq_oss

snd_seq                48848  4 snd_seq_oss,snd_seq_midi_event

snd_seq_device          7180  2 snd_seq_oss,snd_seq

snd_pcm                80968  3 snd_pcm_oss,snd_hda_intel,snd_hda_codecsnd                    46884  9 snd_pcm_oss,snd_mixer_oss,snd_seq_oss,snd_seq,snd_seq_device,snd_hda_intel,snd_hda_codec,snd_pcm,snd_timer

```

----------

## axterics

Ah that's the problem: OSS.. I haven't built in the kernel.. I use only ALSA and alsamixer / amixer.. If I replace volume_up()/down() in fsfn.c with amixer -c 0 Front,0 10%+/- are there any problem? Thanks for the good work you are doing  :Smile:  I think isn't very difficult make a patch for fsfn for Alsa.. if you have time I appreciate it a lot  :Smile: 

----------

## pijalu

 *axterics wrote:*   

> Ah that's the problem: OSS.. I haven't built in the kernel.. I use only ALSA and alsamixer / amixer.. If I replace volume_up()/down() in fsfn.c with amixer -c 0 Front,0 10%+/- are there any problem? Thanks for the good work you are doing  I think isn't very difficult make a patch for fsfn for Alsa.. if you have time I appreciate it a lot 

 

just do

```

wget http://download.berlios.de/fsfn/fsfn-0.2.tar.gz

tar zxvf fsfn-0.2.tar.gz

cd fsfn-0.2

./configure && make && sudo make install

```

I just updated fsfn to support alsa  :Wink: 

btw took me long to figure out how alsa thing work reading amixer src... so code can be "not optimal"  :Wink: 

----------

## G2k

 *pijalu wrote:*   

> just do
> 
> ```
> 
> wget http://download.berlios.de/fsfn/fsfn-0.2.tar.gz
> ...

 to use this new version is that all we have to do or do we have to edit init scripts as well?

----------

## pijalu

 *G2k wrote:*   

>  *pijalu wrote:*   ... to use this new version is that all we have to do or do we have to edit init scripts as well?

 

nope, you can use same init script, no change for init (yet)  :Wink: 

So it should be enought

Btw, if problem with it, just post here  :Smile: 

(alsa is really not as easy as OSS for mixer control  :Sad:  )

----------

## axterics

C00l   :Cool: 

Work greatly    :Smile: 

Now I try to tune xosd colors with my desktop theme and get shorter bar, too long for my flavour   :Cool: 

----------

## G2k

gah! If someone teaches me how to make ebuilds I'll make one for this...it's getting annoying to have to repeat all the steps and modifying the init script (since I was having that problem before) every time I recompile a kernel.

Where can I learn how to make ebuilds? Thanks

EDIT:

I read the how to make an ebuild documentation and it would take me a few years of programming skills to figure it out....I have to learn both how e-builds work and how bash works....blah.

----------

## G2k

who should be asked abou including the sony thing into the kernel? It would be really useful so that I dont have to manually do it every time I compile a new kernel.

thnx

----------

## pijalu

 *G2k wrote:*   

> who should be asked abou including the sony thing into the kernel? It would be really useful so that I dont have to manually do it every time I compile a new kernel.
> 
> thnx

 

You can try but, IMHO, it's obviously too specific to be included in the kernel  :Wink: 

So you will have to keep doing "make && make install" of the sony_acpi (since the rest is not kernel specific)

----------

## G2k

or a patch to the kernel....isn't that what groups like love source and whatnot do?

----------

## pijalu

 *G2k wrote:*   

> or a patch to the kernel....isn't that what groups like love source and whatnot do?

 

hmmm... good luck  :Wink: 

----------

## G2k

this is offtopic but has anyone been able to get the framebuffer image working on the fs 660 or the like (widescreen)...I have tried everything and can't get a nice framebuffer image.

----------

## sound-mind

 *G2k wrote:*   

> this is offtopic but has anyone been able to get the framebuffer image working on the fs 660 or the like (widescreen)...I have tried everything and can't get a nice framebuffer image.

 

Hmmm someone else has asked me the same question via email but I haven't had time to respond.  Yeah I _had_ a framebuffer image working.  What do you need to know?

Slightly more off topic:  I finally managed to get S3/suspend-to-ram to resume properly.  Looks like it was a buggy DSDT.  I'm going to tie the S1 or S2 buttons to trigger a change to that state.  I've only tested the new DSDT on the FS660 but if someone else is interested just let me know...

----------

## G2k

I have my kernel compiled as it says to do here with (1280x800@58 ) VESA default mode. I've emerged splash-themes-gentoo and put this in my /boot/grub/grub.conf

```
title=Gentoo Linux

root (hd0,1)

kernel /kernel-2.6.12-gentoo-r10 root=/dev/hda4 video=vesafb:ywrap,mtrr,1280x800-32@58 splash=verbose,fadein,theme:emergence CONSOLE=/dev/tty1

initrd /boot/fbsplash-emergence-1280x854
```

...sorry this is really offtopic, maybe I should be sending you a private message instead?

----------

## strago

Yeah, nice work...

Just if that can help : if you are not in "type 1" in bios FN control, that's doesn't work... (2hours to find that... :Evil or Very Mad:  )

I'm going to check xosd (doesn't work for the moment) and runlevel script. 

EDIT : FS115M under debian kernel 2.6.13.4 .

----------

## pijalu

 *strago wrote:*   

> 
> 
> ...
> 
> Just if that can help : if you are not in "type 1" in bios FN control, that's doesn't work... (2hours to find that... )
> ...

 

Thanks for the tip   :Very Happy: 

----------

## G2k

a bit OT but can someone explain how to get the suspend to ram to work? I'm having a hard time understanding how to do it. Thnx

----------

## messenjer

Hello Pijalu,

Thanks for your explanation and script.

I easily install your kernel module and script to work with my vaio vgn-fs315b on ubuntu breezy.

I just rewritte /etc/init.d/fsfn to works with debian (runscript is gentoo only).

```
#!/bin/sh

PATH=/sbin:/bin

. /lib/lsb/init-functions

if ! test -e /proc/acpi/sony/fnkey ; then

    log_failure_msg "Sony acpi key handler not found"

    exit 1

fi

case "$1" in

    start)

        log_begin_msg "Starting fsfn key handler"

        start-stop-daemon --start \

                    --nicelevel 10 \

                    --pidfile /var/run/fsfn.pid \

                    -x "/usr/local/bin/fsfn"

        log_end_msg $?

    ;;

    stop)

        log_begin_msg "Stopping fsfn key handler"

        start-stop-daemon --stop --pidfile /var/run/fsfn.pid

        log_end_msg $?

    ;;

    *)

        log_success_msg "Usage: /etc/init.d/fsfn {start|stop}"

        exit 1

esac

exit 0
```

Thanks a lot   :Very Happy: 

Mathieu Laurent

----------

## pijalu

 *messenjer wrote:*   

> Hello Pijalu,
> 
> Thanks for your explanation and script.
> 
> I easily install your kernel module and script to work with my vaio vgn-fs315b on ubuntu breezy.
> ...

 

Thanks to you for the debian script, pretty sure it will be usefull for other people  :Smile: 

I put it in the repos of berlios and bumped version to include it 

Btw,if you writed somewhere a how-to for ubuntu, you can send me the link to it so I can update explanations to include it for ubuntu people ending on gentoo forums  :Wink: Last edited by pijalu on Fri Nov 25, 2005 12:43 pm; edited 1 time in total

----------

## gtwilliams

 *G2k wrote:*   

> hey guys I was wondering if you know a way to have the system shutdown when the battery is low. Right now the only way I can know my battery status is through torsmo, but it would be nice to have the computer shutdown if I'm not around to do it myself. Any success on the suspending to RAM issue?
> 
> Also, will an ebuild for this ever come out :o cus I've been too lazy to attempt getting the FN keys to work properly.
> 
> thanks

 

You might find my approach useful: http://www.zvolve.com/~garry/my-acpi.tar.gz

I also patched the gnome battery monitor to work on the Sony FS640/W with Fedora.  I don't know, if this will help, but you might have a look at the patch at: http://www.zvolve.com/~garry/lappy.html#acpi_support

Hope this helps.

Garry Williams

----------

## aharris

I have a VGN-FS740 notebook. Suse 10.0 installed beautifully and I have almost all ACPI capabilities which Windows provides and more. However the function key combinations for hardware (FN + F5 for screen dimming, etc) do not work. Im hesitant to patch the sony_acpi and I dont really know how anyway.

My problem is that the spicctrl commands return a value of zero no matter what command I use. Do you have any ideas?

Regards,

----------

## pijalu

 *aharris wrote:*   

> I have a VGN-FS740 notebook. Suse 10.0 installed beautifully and I have almost all ACPI capabilities which Windows provides and more. However the function key combinations for hardware (FN + F5 for screen dimming, etc) do not work. Im hesitant to patch the sony_acpi and I dont really know how anyway.
> 
> My problem is that the spicctrl commands return a value of zero no matter what command I use. Do you have any ideas?
> 
> Regards,

 

spicctrl use a hardware device that most (ALL?)  sony vaio FS don't have... If you want to use the sony special keys, I guess you should try to shoot at fsfn... If you follow https://forums.gentoo.org/viewtopic-p-2722251.html#2722251 , you won't have to "patch" sony_acpi, since I put on berlios an already patched module. 

The rest of the explanation will allows you to install a program to handle this module in a "user-friendly" way.  (This will not modify your "in-use" kernel... just add a new module to it). 

The only limitation is: you need to install the tools to compile modules on your suse. I guess this page can give you the needed info: http://www.novell.com/coolsolutions/feature/16340.html

They give a example on how to compile PWC, you can use sony_acpi instead...

Good luck

----------

## aharris

Thank you for your prompt reply and information.

Before my post, I actually downloaded the fsfn tar, ran the ./configure, which complained about libasound and xsod not being present.

I found no libasound for Suse 10, but downloaded the closest which was the latest ALSA packages for Suse 9.x. This satsified the ./configure process. I did the make and make insall, which seemed to go ok.

I started the fsfn daemon by typing 'fsfn' at the terminal prompt, tried my function keys, and got no results. Perhaps I'm doing something wrong here, as I am clearly a linux noob.

The ALSA package for Suse 9.2 downgraded my sound, as no suprise, and caused a repair mess for someone like me.

----------

## pijalu

 *aharris wrote:*   

> Thank you for your prompt reply and information.
> 
> Before my post, I actually downloaded the fsfn tar, ran the ./configure, which complained about libasound and xsod not being present.
> 
> I found no libasound for Suse 10, but downloaded the closest which was the latest ALSA packages for Suse 9.x. This satsified the ./configure process. I did the make and make insall, which seemed to go ok.
> ...

 

To use fsfn, you need to first install and modprobe sony_acpi.

For the dependencies: fsfn use Alsa for the sound, and xosd for the user osd thing. 

Sadly, I don't have a clue on how install the needed dependencies on a SuSe... never used this one  :Wink: 

Maybe try to get help on some SuSe forums for these specific tasks ?

[evangelism] or maybe give a try to a Gentoo ? [/evangelism]  :Wink: 

For the noob feeling... every one has been a noob... don't worry and keep trying (and made looots of backups)  :Wink: 

----------

## messenjer

 *pijalu wrote:*   

> Thanks to you for the debian script, pretty sure it will be usefull for other people 
> 
> I put it in the repos of berlios and bumped version to include it 

 

Thanks a lot. It will be usefull.

 *pijalu wrote:*   

> Btw,if you writed somewhere a how-to for ubuntu, you can send me the link to it so I can update explanations to include it for ubuntu people ending on gentoo forums 

 

Here is the list of ubuntu packages to install :

```
sudo aptitude install gcc make linux-headers-686 libasound-dev libxosd-dev
```

According to your kernel : you can install linux-headers-386, linux-headers-k7, ... instead of linux-headers-686

Regards

Mathieu

Note: I updated to fsfn 0.3-r1 all works fine

----------

## Wizo

Thanks for this great post guys!!!   :Very Happy: 

I had a problem with /dev/input/event0

```
omega init.d # fsfn -n

Opening event interface /dev/input/event0

event interface open failed: No such device
```

but I solved enabling a kernel parameter:

```

Device Drivers

  Input device support

    <*>   Event interface

```

I hope this help anyone who got the same problem!

----------

## pijalu

For all gentooist using fsfn, ebuilds are now available at http://download.berlios.de/fsfn/fsfn_overlay.tar.bz2

you should untar this in your overlay root, this should create app-laptop (if needed) and allows you to emerge sonyacpi and fsfn in a easy way (i hope)

For everyone: fsfn 1.0 is out (http://download.berlios.de/fsfn/fsfn-1.0.tar.gz), in short

* supports hibernate correctly (at least it should)

* determine automagically the right device (no more problems to find out the /dev/input/event to use)

* Customization:

 - all the FN+keys actions via /etc/fsfn.conf

 - OSD colors and font

 - Alsa device name (I read somewhere someone needed that)

* man pages (man fsfn and man 5 fsfn ... use them  :Wink:  )

* init scripts for fedora

All your thanks should go to gtwilliams and soudmind for their works on this

EDIT: 

* 2005-12-13: changed app-misc to app-laptopLast edited by pijalu on Wed Dec 14, 2005 1:17 am; edited 1 time in total

----------

## G2k

gtwilliams, soudmind and pijalu, I love you guys!

 *Quote:*   

> supports hibernate correctly (at least it should)

 So you were able to get hibernation to work? Could you give me some tips on how to do this I haven't had any success   :Surprised:  Thanks so much to all of you!

----------

## pijalu

 *G2k wrote:*   

> gtwilliams, soudmind and pijalu, I love you guys!
> 
>  *Quote:*   supports hibernate correctly (at least it should) So you were able to get hibernation to work? Could you give me some tips on how to do this I haven't had any success   Thanks so much to all of you!

 

take a shoot at garry or soundmind web page, they both got it working and give loads of details for that  :Smile: 

----------

## G2k

ah, did that already. Those are the two guides I followed.

First off, soundmind has a typo there when he says to use the kernel parameter acpi_os_name="Windows Windows XP" (which is not even a 20 character string). It should be acpi_os_name="Microsoft Windows XP". Second, I tried his DSDT and kernel configuration, but I can't even boot up unless I have acpi_skip_timer_override as a kernel parameter in my grub.conf (by the way, I'm using a 2.6.12 kernel). Once I was finally able to boot I was able to suspend but when I hit a key to turn it back on the computer was in an unusable state (blank screen...I can't ssh into this machine so I couldn't see what was going on, but I wasn't running X and I tried doing `sudo /sbin/reboot` [whcih should reboot as regular user for me] which didnt work). garry's version didn't work for me either.  :Crying or Very sad: 

----------

## pijalu

hmmm.... On my side I got suspend to disk working, but this needs me to use nv instead of nvidia (didn't not succeed a on battery with this boy )... Working "ok" - issue is if the machine on battery, then the write to disk takes age (more than 100sec...)  . So I forget about the 2.5min i lost by doing a shutdown/restart of system  :Wink: 

EDIT: just notice something in what you said: Are you using his DSDT ? - Do you have same hardware ? (his dsdt is different from mine... )

----------

## sound-mind

Yeah perhaps forums are a better venue than email for working out these problems... now everyone can benefit.  I fixed the string in my guide, thanks for pointing out that error g2k.  I also updated it with the latest information I have pertaining to the S3 state.  Should we start another thread to discuss these issues perhaps?  

In the meantime, I'm going to compile a kernel w/out the fixed DSDT so I can post that as well.  I'm beginning to think this is related the video drivers I was using at the time.  My emerge.log says I was using nvidia-kernel/nvidia-kernel-1.0.7676 at the time when the suspension and resumption was functioning properly.  Maybe I'll roll back to this with kernel 2.6.12 to see what happens with that combination.

----------

## stevewabc

? I have a sony vgn-s460 and installing fedora fc 4 tonight so will these steps work on fc4 to? thanks  for your input. There just isnt much out there on howto for sony's and us half ass newbees   :Wink: 

----------

## knefas

 *stevewabc wrote:*   

> There just isnt much out there on howto for sony's and us half ass newbees  

 

Man, have you seen this? http://gentoo-wiki.com/HARDWARE_Sony_VGN-S4  :Smile: 

(S4's have different fn key system, btw.  :Smile:  )

----------

## axterics

I want to compliment with pilaju and all the coders for the beatiful work. I use the ebuild and it work greatly.

I suggest 3 things for the next release:

1 Remember moving the advise to launch fsfn -o (xosd support) in the tail of the compilation (I don't see it immediatly..)

2 Create an /etc/fsfn.conf.example with the various option can be changed (I have to look /var/log/messages to understand what change)

3 Add other options changeable (position of bar in the screen, length of the bar, bar style (i saw the xosd api, it is very simple))

 :Very Happy:  thank's a lot guys

----------

## Gremo

hi guys i need help please!

i have compiled the kernel with Sony Programmable I/O Control Device Driver BUILT IN!

node /dev/sonypi exist (not created by me...)

however, running sonypid utiliy does not show pressed keys (show nothing..)

any ideas?

----------

## sound-mind

 *Gremo wrote:*   

> hi guys i need help please!
> 
> i have compiled the kernel with Sony Programmable I/O Control Device Driver BUILT IN!
> 
> node /dev/sonypi exist (not created by me...)
> ...

 

Please post the model of your notebook.  Did you follow the directions here?  The application we've discussing here (fsfn) is different from sonypid since the existing sonypid fn-key mechanism was not compatible with our laptops.

----------

## goom

 *pijalu wrote:*   

> Ok, following 
> 
> ```
> 
> cat /proc/bus/input/devices 
> ...

 

I have a problem. 

```
cat /proc/bus/input/devices 
```

gives me no "event output" like yours, so I cannot "cat"  it. All in all, my system behaves strange concerning all those FN-Keys

```
I: Bus=0011 Vendor=0001 Product=0001 Version=ab41

N: Name="AT Translated Set 2 keyboard"

P: Phys=isa0060/serio0/input0

S: Sysfs=/class/input/input3

H: Handlers=kbd 

B: EV=120013

B: KEY=4 2000000 3802078 f840d001 f2ffffdf ffefffff ffffffff fffffffe

B: MSC=10

B: LED=7

```

```
/etc/init.d/fsfn start
```

starts fsfn, but I see no process, even a fsfn.conf hasn't been created.

After installing the packets you mentioned in your post I do not have /proc/acpi/sony/fnkey. brightness and brightness_default are there and changing brightness works well with

```
echo X > /proc/acpi/sony/brightness
```

But as you may assume, that's not what I want  :Smile: 

----------

## pijalu

I think your current kernel is not build with evdev:

```

$ zcat /proc/config.gz | grep EVDEV

CONFIG_INPUT_EVDEV=y

```

(Y or M should be fine)

If you have a no, then you need to recompile the kernel to include evdev  :Smile: 

----------

## goom

Gonna recompile now   :Embarassed:  I'll post my success (or bust) in a minute  :Razz: 

edit: what is evdev? event device?

Okay, now I got even3 as the result.

```

Sony ~ # /etc/init.d/fsfn stop

 * Stopping fsfn key handler ...

start-stop-daemon: warning: failed to kill 6841: No such process

1 pids were not killed

No process in pidfile `/var/run/fsfn.pid' found running; none killed.     [ !! ]

Sony ~ # /etc/init.d/fsfn start

 * WARNING:  "fsfn" has already been started.

Sony ~ # 

```

worries me .... something wrong with that. But I really dont't know what.

```
Error opening /proc/acpi/sony/fnkey: No such file or directory
```

And still no fnkey in /proc/acpi/sony/  :Sad: 

BTW: Sony Vaio VGN-FS315H

----------

## pijalu

evdev = event devices .... Quite usefull  :Smile: 

(not only for fsfn, for synaptics drivers too)

Hum... for the /proc/acpi/sony/fnkey, can you try

```

# rmmod sony_acpi

# modprobe sony_acpi

# rmmod sony_acpi

# dmesg -c

# modprobe sony_acpi

# dmesg

# ls /proc/acpi/sony

```

and give results of the last dmesg and ls  :Smile: 

Btw, check that the event type in bios is set to type 1

If not working, check (fast) for GHKE entry in dsdt

```

# grep GHKE  /proc/acpi/dsdt

Binary file /proc/acpi/dsdt matches

```

If no match, send me a gz of your dsdt by mail

```

cat /proc/acpi/dsdt | gzip -c >  ~/dsdt.gz

```

should help

----------

## goom

Okay, dunno why, but I went home on friday and when I booted my laptop there I had fnkeys in /proc/acpi/sony. The keys work fine now, except another tiny problem. Muting works fine, but turning sound on doesn't work at all. Additionaly my sound mutes when I want to turn down my sound a bit. So FN+F3 and FN+F2 have the same effect. I really don't know why...

PS: Thanks for your help, getting the keys to work is so really really cool  :Smile:  Very kind of you =)

----------

## pijalu

 *goom wrote:*   

> Okay, dunno why, but I went home on friday and when I booted my laptop there I had fnkeys in /proc/acpi/sony. The keys work fine now, except another tiny problem. Muting works fine, but turning sound on doesn't work at all. Additionaly my sound mutes when I want to turn down my sound a bit. So FN+F3 and FN+F2 have the same effect. I really don't know why...
> 
> PS: Thanks for your help, getting the keys to work is so really really cool  Very kind of you =)

 

Hum... Do you have Alsa installed ?

If yes, there can be multiple reason for such behaviours

a) The volume control is not named "Front" - You can check this looking on your volume control and see if it's called Front, if not, you need to write down the name and edit/create a file called /etc/fsfn.conf and add an entry like

```

ALSA_NAME=TheNameUsed

```

(with TheNameUsed = the main volume name)

b) Something broken in acpi: you need to d/l + install the dev version at http://users.skynet.be/muaddib/fsfn/fsfn-1.1.tar.gz (ebuild)

And try adding in /etc/fsfn.conf

```

BRT_SETDEFAULT=1

```

and/or

```

BRT_HACK_FJS=1

```

(This version allows a few more settings - see man 5 fsfn)

Hope this helps

----------

## goom

Nice. Helped a lot. Everything works fine now. Thanks for your support. Impressive knowledge  :Smile:   Creating the .conf file with "ALSA_NAME=FRONT" did it. Additionaly I installed fsfn-1.1. 

Thanks again.

----------

## Gremo

hi,

here some problems only with xosd version of the script:

i have downloaded and installed fsfn version 1.0:

1) as a root, i can't run fsfn (there is no file...)

2) as a normal user, i can run fsfn (nothing appens) but can't run fsfn -o (Xlib: connection to ":0.0" refused by server

Xlib: No protocol specified)

3) I don't have /etc/fsfn.conf

bad version?

ps. script posted in the first page works well, but i would try osd support  :Smile: 

thanks a lot great forum!!

----------

## Gremo

just another question: 

is it possible to make a kernel patch to include as a module sony_acpi (patched version) ?

----------

## Gremo

up   :Embarassed: 

----------

## pijalu

Hi, sorry for the delay...

Can you download http://users.skynet.be/muaddib/fsfn/fsfn-1.1.ebuild , put it in your overlay and emerge this version (Latest dev version -> it will be easier for me to help you if you still have troubles with it  :Wink: 

* After emerge, to start use /etc/init.d/fsfn (as root on command line or add it using rc-update)

* For the OSD, you must launch the "fsfn -o" as "normal" user, inside your X session (hint: gnome-session / kde Autostart).... The error you have seems coz you lauch it outside of X 

* for the /etc/fsfn.conf : The ebuild don't install it. Only needed if you want to change/tweak the default settings (cf man 5 fsfn)

* For the kernel patch, shouldn't be a problem,  but I think it's easier to use an external module: you don't need to find a patch again your current kernel... you just need to recompile the module (if you used sony_acpi ebuild, check sys-kernel/module-rebuild  :Wink: )

----------

## Gremo

 *pijalu wrote:*   

> Hi, sorry for the delay...
> 
> Can you download http://users.skynet.be/muaddib/fsfn/fsfn-1.1.ebuild , put it in your overlay and emerge this version (Latest dev version -> it will be easier for me to help you if you still have troubles with it 
> 
> * After emerge, to start use /etc/init.d/fsfn (as root on command line or add it using rc-update)
> ...

 

Very thanks for helping a newbie  :Smile: 

i got some errors i cannot undestand: 

1) emerged successfully fsfn & sonyacpi ebuilds overlays

2) rc-update add fsfn default

3) After loading stufs like alsa...

```

fsfn[12141] config...

fsfn[12141] config...

fsfn[12141] config...

fsfn[12141] config...

fsfn[12141] default configuration done

fsfn[12141]error opening config file[/b]

fsfn[12141]autodevice determines /dev/inpu/event-1 as keyboard event

fsfn[12141]event interface (/dev/input/event-1) open failed: no such file or direcotory

fsfn[12141]autodevice determines /dev/inpu/event-1 as last chance keyboard event

fsfn[12141]event interface (/dev/input/event-1) open failed: no such file or direcotory

```

maybe some kernel features missing?   :Embarassed:   :Embarassed: 

4) where to add /usr/bin/fsfn -o? How, can you explain exactely? I'm a two-mounths gentoo user  :Smile: 

bye!

----------

## Gremo

thanks to Pierre i have solved my problems, it was evdev not enabled in config.

Anyone can use SI & S2 buttons?

i can't...

----------

## pijalu

 *Gremo wrote:*   

> thanks to Pierre i have solved my problems, it was evdev not enabled in config.
> 
> Anyone can use SI & S2 buttons?
> 
> i can't...

 

You should be able to add the 2 following entries in /etc/fsfn.conf:

S1_CMD=somecommand

S2_CMD=somecommand

Limitations:

* The command cannot take parameters (if you need parameters, then you will need to create a shell script to execute the command

* The command will be executed as root and not as current user

----------

## Gremo

 *pijalu wrote:*   

>  *Gremo wrote:*   thanks to Pierre i have solved my problems, it was evdev not enabled in config.
> 
> Anyone can use SI & S2 buttons?
> 
> i can't... 
> ...

 

so..is this right?

turn off monitor...

```

# touch lcdoff

# echo "xset dpms force off" > lcdoff

# chmod u+x lcdoff

# S1_CMD=/path/to/lcdoff

```

----------

## pijalu

Actually no, because xset has to be executed by current user in your X session... something the daemon cannot do  :Sad: 

(yet... but I am currently out of time to correct this...but it's still on my todo list... maybe this week-end if i found the time... drop me mail if you don't see news next monday to complain about it  :Wink:  )

----------

## Gremo

 *pijalu wrote:*   

> Actually no, because xset has to be executed by current user in your X session... something the daemon cannot do 
> 
> (yet... but I am currently out of time to correct this...but it's still on my todo list... maybe this week-end if i found the time... drop me mail if you don't see news next monday to complain about it  )

 

ok, thanks again, i think power off monitor is a must for a laptop user

----------

## pijalu

 *Gremo wrote:*   

>  *pijalu wrote:*   Actually no, because xset has to be executed by current user in your X session... something the daemon cannot do 
> 
> (yet... but I am currently out of time to correct this...but it's still on my todo list... maybe this week-end if i found the time... drop me mail if you don't see news next monday to complain about it  ) 
> 
> ok, thanks again, i think power off monitor is a must for a laptop user

 

EDIT: See next post  :Smile: Last edited by pijalu on Sun Apr 16, 2006 4:37 pm; edited 1 time in total

----------

## pijalu

Call for testers

Hi, just finished my work on fsfn 1.2 and this one needs testers before going public  :Wink: 

ebuild - tarball

Changes:

* The OSD supports cmd execution using ~/.fsfn.conf file (for commands not set in /etc/fsfn.conf) 

* new use flag (or --enable-moreconf [configure]) : allows settings of "internal" keycode to support exotic new Vaio laptop

* More bugs ???  

Have phun

----------

## G2k

```
# emerge -avuD world

These are the packages that I would merge, in order:

Calculating world dependencies

emerge: there are no ebuilds to satisfy ">=app-laptop/sonyacpi-0.1".

(dependency required by "app-misc/fsfn-1.2" [ebuild])

!!! Problem resolving dependencies for app-misc/fsfn

!!! Depgraph creation failed.
```

I have sonyacpi in /usr/local/portage/app-misc. Maybe we should establish a universally correct path for the sonyacpi ebuild?

Edit:

after having restarted /etc/init.d/fsfn, restarting X and chaning the setting in my ~/.fluxbox/startup to `/usr/bin/fsfn -o &` it seems to be working properly. I didn't try the new use flag though as I don't understand what it's for exactly (I'm using a vaio vgn-fs660)

Just a thought but do you think that the xosd part of fsfn could become prettier? Like, if you look at amaroK's OSD it has some pretty nice features such as alpha blending, color selection, font selection and a fade-out. Could the same be done for fsfn's OSD?

Thanks for the hard work!

----------

## pijalu

 *G2k wrote:*   

> 
> 
> ```
> # emerge -avuD world
> 
> ...

 

Thx for testing,

for the ebuild path, app-laptop seems to be the most correct, at least for me  :Wink: 

The new flag (moreconf) should'nt be used unless you NEED it, since it eat more CPU - this should be reserved for some exotic laptop  :Wink:  (A user of a Vaio VGN-FJ170/B sended a patch to help supporting his laptop)

For the OSD, you can change the font and color using /etc/fsfn.conf or ~/.fsfn.conf. (check man 5 fsfn)

eg: my ~/.fsfn.conf:

```

OSD_FONT=-*-lucida-*-*-*-*-14-*-100-100-*-*-*-*

OSD_VCOLOR=green

OSD_VCOLORZ=red

OSD_BCOLOR=LawnGreen

OSD_MSG_VOLUME=Volume (%d %%)

OSD_MSG_BRIGHT=Brightness (%d)

SOUND_STEP=5

S1_CMD=/usr/bin/dpmsoff

```

To be honest, I just wanted to allow "user space" execution for this version (since this is a really important features....), for OSD look... hmmm, would be great but I don't have really lots of time to play with this  :Wink: 

But feel free to propose a patch for this feature  :Wink: 

----------

## at240

pijalu, THANKS---v1.0 worked perfectly straight away on a new FS415M.   :Very Happy:   Great little utility. Are you going to try to get it into portage? It certainly deserves to be there.

One little thing I noticed was: when I adjust the brightness, the first time the on-screen gauge appears it appears in a low position. From then on when it reappears it always appears in a higher position, exactly where the volume display appears. Is this a tiny bug?

Thanks again.

----------

## G2k

There's an in-kernel option called SONYPI...is this the equivalent of the sony-acpi ebuild? Should the fsfn ebuild be updated to account for the already present sonypi or the lack thereof?

----------

## pijalu

sonypi is not compatible with the FS laptop series  :Smile: 

----------

## B2382F29

Ok, tried everything, my Laptop (VGN-FS115B) won't work with fsfn

/proc/acpi/sony/fnkeys exists

with sonyfn (polling) the keys are working.

cat /dev/input/event2

shows garbage when pressing the fn-keys

in syslog, i get this:

 *Quote:*   

> atkbd.c: Unknown key pressed (translated set 2, code 0xf6 on isa0060/serio0).
> 
> atkbd.c: Use 'setkeycodes e076 <keycode>' to make it known.

 

This is the relevant output from /proc/bus/input/devices

 *Quote:*   

> I: Bus=0011 Vendor=0001 Product=0001 Version=ab41
> 
> N: Name="AT Translated Set 2 keyboard"
> 
> P: Phys=isa0060/serio0/input0
> ...

 

fsfn seems to ignore it completely

Someone has an idea?

----------

## pijalu

 *B2382F29 wrote:*   

> Ok, tried everything, my Laptop (VGN-FS115B) won't work with fsfn
> 
> /proc/acpi/sony/fnkeys exists
> 
> with sonyfn (polling) the keys are working.
> ...

 

This message is "normal", the reason is fn+key generate a key, but the kernel don't know what to do with it... If you take a look at the init script, you can set a fake key value to it in order to avoid this error message.

What I will like to see is the output of fsfn on syslog (you need to start the fsfn service or launch fsfn as root)  :Smile: 

----------

## B2382F29

Here's the output:

 *Quote:*   

> May 10 16:00:24 vaio fsfn[11321]: Setting default configuration
> 
> May 10 16:00:24 vaio fsfn[11321]: Configuration: DEVICE=AUTO
> 
> May 10 16:00:24 vaio fsfn[11321]: Configuration: ALSA_NAME=Front
> ...

 

----------

## pijalu

 *B2382F29 wrote:*   

> Here's the output:
> 
> [snip]
> 
> 

 

Hmm... I don't see any loading problems and the logs seems fine (fsfn determined right event) - I will need to send you some test file to launch in order to see why the hell fsfn don't react to keypress... But for this I still need to get back home (and I am now on travel). I hope to be able to look at this friday evening... 

(btw, fsfn should work with your laptop since.... it's quite the same model as mine  :Smile:  )

----------

## pijalu

Ok

First, reboot, go into the bios and check that your hotkey is "Type 1" (if not, check if fsfn is not working, if not continue)

Please download this file: http://users.skynet.be/muaddib/fsfn/evtest.c

Then, compile it using

```

gcc -o evtest evtest.c

```

Then, as root, launch it with the correct keyboard event... eg, my keyboard is mapped on /dev/input/event0

```

# evtest /dev/input/event0

```

It will start to give lots of information on the device... then press Fn+F3,Fn+F4 (press couple of Fn function) and check you actually see output... 

eg:

```

# ./evtest /dev/input/event0

Input driver version is 1.0.0

Input device ID: bus 0x11 vendor 0x1 product 0x1 version 0xab41

Input device name: "AT Translated Set 2 keyboard"

Supported events:

  Event type 0 (Sync)

  Event type 1 (Key)

    Event code 0 (Reserved)

[snip]

Event: time 1147517489.844776, -------------- Report Sync ------------

Event: time 1147517489.939011, type 4 (Misc), code 4 (ScanCode), value f5

Event: time 1147517489.939034, type 1 (Key), code 245 (?), value 0

[snip]

```

(to exit -> Ctrl+c)

All the different keys should return same info lines.... (if not, then it's interesting  :Smile:  )

Now, still as root, do:

```

# killall fsfn

# fsfn -n

```

(try to put brightness to max then to min... ==> couple of Fn-F6 / Fn-F5 - fsfn SHOULD not return to prompt and btw, you should see any REAL change on your brigthness, if you see brightness change, then fsfn is working)

----------

## B2382F29

Working now, the Event Type in BIOS was on Type 2

(that was set when i bought the laptop, is that the default?. If Type 2 is the default setting then maybe you could put a warning in syslog or manpage or something...)

Setting it on Type 1 made it work.

Thanks!!

----------

## pijalu

 *B2382F29 wrote:*   

> Working now, the Event Type in BIOS was on Type 2
> 
> (that was set when i bought the laptop, is that the default?. If Type 2 is the default setting then maybe you could put a warning in syslog or manpage or something...)
> 
> Setting it on Type 1 made it work.
> ...

 

The main problem is to find a sure way to know what is the current type.... 

All I know is what I learned from my machine... where type was factory set on 1  :Smile: 

(if you got your entry at Sony then feel free to ask them info  :Wink:  )

Currently, fsfn is defaulted to type 1 and don't know what the bios settings... emerging it with moreconf use flag allows a redefinition of these mapping in /etc/fsfn.conf ... (it's documented in man 5 fsfn - intended for supporting "strange laptops" - this can still be used for different types)...

If you still dual-boot to windows, please check your keys are still working... if not, tell me (==> then I will change fsfn codes to supports the 3 types)

----------

## B2382F29

keys are still working in windows ...

thanks again.

----------

## B2382F29

Is there a possibility to use Gnome OSD instead of XOSD for fsfn?

----------

## pijalu

 *B2382F29 wrote:*   

> Is there a possibility to use Gnome OSD instead of XOSD for fsfn?

 

Sure, but it will needs you to code a little bit  :Wink: 

osd stuff is stored in osd.h and osd.c...

fsfn first call osd_load to create/init OSD

then it call osd_brightness / osd_volume with new levels when needed

Finally, when fsfn finish, it calls osd_unload...

Check osd.c to see implementation with XOSD (there you can see how to get config values as well)

Have phun and if working well, send me the patch  :Wink: 

----------

## Peach

recently xosd is not working anymore on my machine, while fsfn still works.

```
* x11-libs/xosd

     Available versions:  2.2.8-r1 ~2.2.10 ~2.2.14

     Installed:           2.2.8-r1
```

even trying with osd_cat does anything.  :Sad: 

----------

## pijalu

Hum.... 

by fsfn still working, do you say the osd part of fsfn ?

osd_cat, do you get errors ?

if nope, try something like

```

echo Hello World | osd_cat -f "-*-lucida-*-*-*-*-24-*-*-*-*-*-iso8859-1" -p middle -A center

```

If not working, try latest testing one, i don't have any troubles with it, even if i am running Xgl  :Wink: 

```

* x11-libs/xosd 

     Available versions:  2.2.8-r1 2.2.10 2.2.14

     Installed:           2.2.14

     Homepage:            http://www.ignavus.net/

     Description:         Library for overlaying text/glyphs in X-Windows X-On-Screen-Display plus binary for sending text from command line

```

Good luck  :Smile: 

----------

## Peach

 *pijalu wrote:*   

> Hum.... 
> 
> by fsfn still working, do you say the osd part of fsfn ?
> 
> osd_cat, do you get errors ?
> ...

 

this example works!

(my tryouts didn't work 'cause I didn't read the man  :Razz:  )

----------

## pijalu

So I think the problem lies in your fonts....

If fsfn osd got problems, the solution can be to add(or create if needed) in /etc/fsfn.conf

```

OSD_FONT=-*-lucida-*-*-*-*-24-*-*-*-*-*-iso8859-1

```

----------

## Peach

 *pijalu wrote:*   

> So I think the problem lies in your fonts....
> 
> If fsfn osd got problems, the solution can be to add(or create if needed) in /etc/fsfn.conf
> 
> ```
> ...

 

ok, created the file, restarted /etc/init.d/fsfn, and still no display  :Confused: 

----------

## pijalu

ok, first thing to try is to rebuild xosd then fsfn to be sure you don't have some build problems,

next step will be to do a "killall fsfn" (as user - only to kill the osd client) - then do a 

```

tail -f /var/log/messages | grep fsfn

```

(check fsfn syslog messages)

and launch fsfn "osd" as user: 

```

fsfn -o

```

Then play a little bit with fn keys and check for "some errors" on syslog

(if the brightness/volume don't work, then you did a killall as root... restart fsfn service and start fsfn "osd")

----------

## Peach

hi, I've done all you've suggested and it seems like the init script isn't working well, infact:

```
$ killall fsfn

fsfn(31914): Operation not permitted

fsfn: no process terminated
```

and then did

```
$ fsfn -o 
```

while with root:

```
# tail -f /var/log/messages | grep fsfn

May 30 12:01:19 lemontree fsfn[2209]: Loading config file /etc/fsfn.conf

May 30 12:01:19 lemontree fsfn[2209]: Setting default configuration

May 30 12:01:19 lemontree fsfn[2209]: Configuration: DEVICE=AUTO

May 30 12:01:19 lemontree fsfn[2209]: Configuration: ALSA_NAME=Front

May 30 12:01:19 lemontree fsfn[2209]: Configuration: F12_CMD=/bin/hibernate

May 30 12:01:19 lemontree fsfn[2209]: Configuration: OSD_VCOLOR=red

May 30 12:01:19 lemontree fsfn[2209]: Configuration: OSD_BCOLOR=blue

May 30 12:01:19 lemontree fsfn[2209]: Configuration: OSD_FONT=-*-*-*-*-*-*-20-*-*-*-*-*-*-*

May 30 12:01:19 lemontree fsfn[2209]: default configuration done

May 30 12:01:19 lemontree fsfn[2209]: Configuration: OSD_FONT=-*-lucida-*-*-*-*-24-*-*-*-*-*-iso8859-1

```

Am I missing some step? should I have to launch the fsfn osd "by hand"? isn't this launched automatically with the init scipt?

(thanks for your great support)

----------

## pijalu

 *Peach wrote:*   

> hi, I've done all you've suggested and it seems like the init script isn't working well, infact:
> 
> ```
> $ killall fsfn
> 
> ...

 

The operation not permitted is normal since killall was run as normal user ==> you cannot kill the daemon but only the client

 *Peach wrote:*   

> 
> 
> [snip]
> 
> Am I missing some step? should I have to launch the fsfn osd "by hand"? isn't this launched automatically with the init scipt?
> ...

 

The init script only launch the daemon part (the one in charge of changing volume/brightness) - the osd part rely on the deamon to do everything except "showing a graphical output".

Since the output is X centric (and for some security reason), the client must run with same priviledge as the X user (aka: you user).

So the "fsfn -o" must be added in your GUI (kde,gnome) session - this will allows OSD to work (otherwise, fn key will still work but without output)

Just to be sure, when you start "fsfn -o" and play with fn-key, do you have some OSD output and is the fn key or nothing ?

If not, do you see any "error" output in syslog (fsfn and "osd" should output errors on syslog - The previously posted output are "normal") and last but not least, fsfn -o must not go back to command line (it does not daemonize... if you come back to command line ==> it dies)

Btw, for the support, lets wait you got it working  :Wink: 

----------

## Peach

ok

launching fsfn -o in the terminal works well, without problems.

I've checked everything and found where my problem relies. I just realized and feeled dumb.

I'm using xfce4 and entrance as login manager. as you may know creating ~/.xsession does not work if you forget, or don't want to use the specific /etc/X11/Session/Xsession , instead you have to modify the current startup session and add what you need.

And now it comes the problem (me).

I did update the correct Xfce session starter, duplicating it.

Now, once updated entrance, I forget to use the correct one.

I do feel idiot.

I must congrat for your great support.

Thanks again.

----------

## pijalu

I won't be the one who will blame you for a misconfiguration...

Good to hear your problem is fixed  :Smile: 

----------

## QuimaxW

I've decided to quit being an information leech, and start contributing back to the community!  :Smile:   I've been using SuSE since 8.2...

Getting FSFN to work with SuSE 10.1 on my Sony FS742/W

Extra Packages to install via yast

Xosd

alsa-devel

gtk2-devel 

kernel source

Download, and install manually xosd from http://www.ignavus.net/software.html  For some reason, with the xosd rpm, the development headers aren't installed, and for me, fsfn wouldn't compile without this step.

install fsfn per the instructions, it should work as advertised

(I rebooted, don't know if it's necessary...)

AS ROOT run fsfn  there is no output, no nothing that tells you it's working.

then run fsfn --osd & (& tells bash to run in background as a daemon), and you'll get the on screen pretty when you push a function button.  :Smile: 

After this, I havn't gotten anywhere...my to do list includes:

FN_12 to hibernate...command is powersave --suspend-to-disk -U  but my fsfn seems to be ignoring my /etc/fsfn.conf file.

S1 & S2, I don't know what to do with those quite yet...

Have the programs start at boot, I havn't figured out where to put the commands to have this happen yet.

----------

## pijalu

 *QuimaxW wrote:*   

> I've decided to quit being an information leech, and start contributing back to the community!  

 

Nice.. Welcome aboard and thanks  :Wink: 

 *QuimaxW wrote:*   

> 
> 
> [snip]
> 
> (I rebooted, don't know if it's necessary...)
> ...

 

No but not really bad

```

# modprobe sony_acpi

# rmmod sony_acpi

# modprobe sony_acpi

```

Should do the trick in most of the case (for some reason, the first time sony acpi loads the /proc/acpi/sony is not complete...) 

 *QuimaxW wrote:*   

> 
> 
> AS ROOT run fsfn  there is no output, no nothing that tells you it's working.
> 
> 

 

Actually there is, in the syslog (/var/log/messages) - who say syslog is not user friendly ?  :Wink: 

 *QuimaxW wrote:*   

> 
> 
> After this, I havn't gotten anywhere...my to do list includes:
> 
> FN_12 to hibernate...command is powersave --suspend-to-disk -U  but my fsfn seems to be ignoring my /etc/fsfn.conf file.
> ...

 

For programs you need to run as root: put them in /etc/fsfn.conf - there is one limitation: It can only launch program without parameters --> you need to create a script if the program you need to lauch has parameters... When loading the deamon, you should see what command fsfn will use

For "user space" program, $HOME/.fsfn.conf, this will be used only by OSD (output still in syslogs) (only latest version - the one posted in this forums)

If you want to debug, kill and restart the deamon in "interactive mode" ==> 

```

# fsfn --nodeamon

```

The output of the execution should go to the console

For S1 I use the script given by one user (blank screen) in my $HOME/.fsfn.conf

```

#!/bin/bash

xset dpms force off

```

For S2 --> a gdm-stop command in /etc/fsfn.conf .... only for the moment when X die badly on me (Xgl powered  :Wink:  )

And once again, thanks for the how-to for SuSE  :Smile: 

----------

## QuimaxW

A Runlevel (system services) script can be found here: http://qplace.homelinux.net/fsfn  Theoretically, one can place it in their /etc/init.d folder and the system will find it, it just needs to be enabled via YaST (in SuSE anyways).  I'm hoping someone with more expertise then myself can look through it.  I got it to work, without the on screen display eye candy which I still have to start manually.  Perhaps I should just add fsfn --osd to a KDE login script.  Course, I don't know where that is either, but one can find many things via google.

----------

## Gremo

Hi!

i modified a patch (http://www.popies.net/sonypi/) in order to work with gentoo-sources 2.6.16-gentoo-r9 (should work with 2.6.16 rX) and in order to have /proc/acpi/sony/*.

So you don't have to re-emerge sonyacpi everytime you rebuild your kernel...

this is the first time, so please test it and report me if you got errors.

```

# cp sony_acpi-<version>.patch /usr/src/linux

# patch -p1 < sony_acpi-<version>.patch

(new item under ACPI (Advanced Configuration and Power Interface) Support)

```

for 2.6.16-r*

here: http://digilander.libero.it/gremo_registration/sony_acpi-2.6.16.patch

for new 2.6.17

here: http://digilander.libero.it/gremo_registration/sony_acpi-2.6.17.patchLast edited by Gremo on Tue Jun 20, 2006 1:31 am; edited 1 time in total

----------

## Gremo

you can also delete the line "sonyacpi" under "DEPEND" in your fsfn-1.1.ebuild overlay and unmerge sonyacpi.

----------

## Gremo

new 2.6.17 kernel gentoo-source, new patch here:

http://digilander.libero.it/gremo_registration/sony_acpi-2.6.17.patch

----------

## brfsa

I finished a new version of sonypid

A modified version of the original sonypid source code plus some code from the project in this thread.

The first version features:

* OSD screen bar

* Brightness control

* Volume control

* Mute control

Requirements:

* x11-libs/xosd

* kernel 2.6 with the default sony ACPI support compiled in. (Not the patched one)

* kernel headers 

Get it here:

ftp://iele.au.edu/sonypid-ng/sonypid-ng-0.1.tar.bz2

ftp://iele.au.edu/sonypid-ng

hope it can be useful.

suggestions and changes are very welcome!

:p

----------

## at240

pijalu

OSD is suddenly not working, even though fsfn is (i.e. volume/brightness change, but without on-screen display).

I'm guessing that the upgrade to xorg7 has done this. (But other applications that used OSD (e.g. amarok, K3B) are still working with it successfully.)

Any idea how I can get it working again? Let me know what information you need. 

Many thanks.   :Smile: 

----------

## pijalu

Hmm.... sound strange since I am using Xorg7 (with and without Xgl) without any troubles.... 

K3B et amarok use another code for osd, but not xosd as far as I know

Are you sure the fsfn -o is started ?

If yes, do you have some syslog fsfn message ?

One thing to try is to re-emerge xosd then fsfn in case of a broken deps and try osd_cat

(see osd_cat --help or man osd_cat) to try it in stand-alone way

----------

## at240

Thanks for such a quick reply! Much appreciated.

 *pijalu wrote:*   

> 
> 
> Are you sure the fsfn -o is started ?

 

Definitely.

 *pijalu wrote:*   

> 
> 
> If yes, do you have some syslog fsfn message ?
> 
> 

 

Yes. Whenever I hit Fn+whatever...

```
Jul  8 16:06:09 localhost fsfn[7895]: Failed critical setup onscreen display: (null)

```

appears in the log.

 *pijalu wrote:*   

> 
> 
> One thing to try is to re-emerge xosd then fsfn in case of a broken deps and try osd_cat
> 
> (see osd_cat --help or man osd_cat) to try it in stand-alone way

 

Re-emerged both. I can get output that way via osd_cat, but still nothing from fsfn.

Thanks again.

----------

## pijalu

Ok, 

I just made a few change to osd code to get less critical part in xosd init and more details error output, you can get the latest tarball at http://users.skynet.be/muaddib/fsfn/fsfn-1.2-r1.tar.gz .... Give me the syslog output and cross your finger   :Wink: 

----------

## at240

Still not appearing, I'm afraid. Error is slightly different: it cycles through these three on each Fn+whatever keypress.   :Confused: 

```
Jul  8 18:55:49 localhost fsfn[12468]: Failed critical setup onscreen display: (null)

Jul  8 18:55:49 localhost fsfn[12499]: Failed critical setup onscreen display: (null)

Jul  8 18:55:49 localhost fsfn[12506]: Failed critical setup onscreen display: (null)

```

Weird. Any more ideas? I keep trying to figure out if I've done something stupid to cause this, but I really can't think of anything.

Thanks.   :Smile: 

----------

## pijalu

Are you sure this is the "latest" version log ?

I changed the code to show the function name who gave error   :Question: 

```

$ grep "Failed cr"  berlios-svn/fsfn/src/*.c

berlios-svn/fsfn/src/osd.c:   syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_bar_length", xosd_error);

berlios-svn/fsfn/src/osd.c:   syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_pos", xosd_error);

berlios-svn/fsfn/src/osd.c:          syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_align", xosd_error);

berlios-svn/fsfn/src/osd.c:          syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_vertical_offset", xosd_error);

berlios-svn/fsfn/src/osd.c:   syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_bar_length", xosd_error);

berlios-svn/fsfn/src/osd.c:   syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_pos", xosd_error);

berlios-svn/fsfn/src/osd.c:          syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_align", xosd_error);

berlios-svn/fsfn/src/osd.c:          syslog (LOG_CRIT, "Failed critical setup onscreen display: %s : %s\n","xosd_set_vertical_offset", xosd_error);

```

==>Message should be "Failed critical onscreen display: function : specific error code"

----------

## at240

pijalu

I'm an idiot.   :Razz:   Sorry. 

I tried the new version and it is working again. However, for your information, errors are still being reported in the log:

```
Jul  8 21:08:40 localhost fsfn[17440]: Failed non critical setup onscreen display: xosd_set_color : (null)

Jul  8 21:08:40 localhost fsfn[17440]: Failed some non-critical setup onscreen display

```

happens on each fn+whatever keypress.

Thanks so much for the help---appreciate it.   :Very Happy: 

----------

## pijalu

 *at240 wrote:*   

> pijalu
> 
> I'm an idiot.    Sorry. 
> 
> I tried the new version and it is working again. However, for your information, errors are still being reported in the log:
> ...

 

No prob - so it looks like xosd has a hard time to set color... hmm... You can try to create (if not yet created) a file: /etc/fsfn.conf and put/add these lines:

```

OSD_VCOLOR=green

OSD_VCOLORZ=red

OSD_BCOLOR=LawnGreen

```

(if you already have a /etc/fsfn.conf or a .fsfn.conf , check if you have any settings associated to these keys - if yes, put them in comment (#) or try with the one i just gave...)

----------

## at240

OK, I tried that---still the same error:

```
Jul  9 22:46:39 localhost fsfn[16871]: Failed non critical setup onscreen display: xosd_set_color : (null)

Jul  9 22:46:39 localhost fsfn[16871]: Failed some non critical setup onscreen display

```

It's definitely loading those settings you gave me, because I can see them reported in the syslog earlier when fsfn is started. 

Now you mention it, I've realised that since it's started working again, the colour of the OSD bars is white---before, it was red. So someting has changed.

I'm also suddenly seeing this in syslog now:

```
Jul  9 20:32:15 localhost ACPI Error (psargs-0353): [PKG0] Namespace lookup failure, AE_NOT_FOUND

Jul  9 20:32:15 localhost ACPI Error (psparse-0517): Method parse/execution failed [\_SB_.BAT0._BST] (Node dfec81e0), AE_NOT_FOUND
```

But I'm assuming this is nothing to do with the sonyacpi module and is something else entirely---am I right?

Thanks again for the help---despite those syslog messages, it seems to be functioning OK.

----------

## pijalu

Just wanted to be sure about the error... for some reason, your xosd seems to not be able to handle colors anymore... pretty strange... the only way to solve this will be to actually debug it and see why your install don't handle colors anymore on xosd... Until then, your OSD will have default colors - but at least it will continue to work

For your acpi error, this is not a big deal, just ACPI trying to map an entry not existing in your ACPI or a buggy sony acpi method call... but it's not a big deal... maybe just unexact battery levels...

----------

## at240

Well, I can live with that!

Once again, thanks for the great responses---much appreciated.   :Smile: 

----------

## LaintalAy

After upgrading the kernel to an 2.6.17 version, the node /dev/input/event0 disappeared but everything else was fine and none of the other event interfaces works with fsfn.

If anyone has this problem, it can be solved creating the node

```
 mknod /dev/input/event0 c 13 64
```

It was a desesperate bet to getting FN keys working after several hours searching a solution without results... and it works  :Smile: 

----------

## Phk

Hi there everyone

First of all, congrats!! Great tool  :Smile: 

I made exactly like it was written here, but manually setting brightness fails, and the "fnkey" file does not exist..

Also, when i "cat /dev/input/event0" the "FN" key does nothing, no bogus garbage....  :Sad: 

your module loads perfectly, no bad output messages..

I have a sony vaio fe31m. Is this the main problem...?   :Embarassed: 

cheers  :Smile: 

----------

## Frez

 *Phk wrote:*   

> 
> 
> I made exactly like it was written here, but manually setting brightness fails, and the "fnkey" file does not exist..
> 
> 

 

Hi. sony_acpi seems to fail on my FE31M too (no fnkey, brigthness setting doesn't work).

I use smartdimmer to set brightness.

I'm still fighting against FN keys.

Almost no hope to see my face through the motion eye camera  :Sad: 

----------

## pijalu

Hi guys,

Did you give a shoot with sonypi ?

The main issue of Sony is they don't keep a "one way" to do things... and since I don't have the same model, I sadly cannot really help on this issue... 

Anyway, when you do cat of /proc/acpi/fnkey, did you see the value change following the fnkeys pressed ?

----------

## Phk

Hi!

For now i've managed to work with brightness and volume using xsetkeys... but.... Not using the FN key.. I'm using the LeftControl key instead   :Embarassed:  heh! At least it works!  :Razz: 

 *pijalu wrote:*   

> Anyway, when you do cat of /proc/acpi/fnkey, did you see the value change following the fnkeys pressed ?

 

I am almost sure that nothing happened, however, i'll try it again later today.

cheers!

----------

## Hadriel

@frez

glad to see a fellow vaio FE owner (mine is the fe21h). 

i have the same problem with the fn keys (and the webcam) as you. i tried spca5xx drivers, with no luck.i should write an email to the devs and send them some information on the device  :Wink: 

thx for posting that smartdimmer link, works like a charm. do you know if it really uses less energy?  would be cool if this actually extends the battery time.

i am going to build that into my battery mode  :Smile: 

found out that the cam will possibly be included in the next release of the gspca drivers. not sure tho.

----------

## G2k

two questions:

is there an ebuild for the most recent fsfn version?

and

where do I put the startup command "fsfn -o" if I'm using GNOME?

Thanks   :Smile: 

----------

## pijalu

 *G2k wrote:*   

> two questions:
> 
> is there an ebuild for the most recent fsfn version?
> 
> and
> ...

 

1) http://users.skynet.be/muaddib/fsfn/fsfn-1.3.ebuild (no big changes btw)

2) System / Preferences / Sessions

Startup Programs Tab => add an entry with "fsfn -o"

----------

## G2k

```
>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/fsfn-1.3/work/fsfn-1.3 ...

 * 

 * xosd support built in

 * To enable it, please add 'fsfn -o' to your x session

 * 

 * econf: updating fsfn-1.3/config.guess with /usr/share/gnuconfig/config.guess

 * econf: updating fsfn-1.3/config.sub with /usr/share/gnuconfig/config.sub

./configure --prefix=/usr --host=i686-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --build=i686-pc-linux-gnu

checking for a BSD-compatible install... /bin/install -c

checking whether build environment is sane... configure: error: newly created file is older than distributed files!

Check your system clock

!!! Please attach the following file when filing a report to bugs.gentoo.org:

!!! /var/tmp/portage/fsfn-1.3/work/fsfn-1.3/config.log

!!! ERROR: app-laptop/fsfn-1.3 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_compile

  ebuild.sh, line 937:   Called src_compile

  fsfn-1.3.ebuild, line 36:   Called econf

  ebuild.sh, line 540:   Called die

!!! econf failed

!!! If you need support, post the topmost build error, and the call stack if relevant.

!!! This ebuild is from an overlay: '/usr/local/portage'
```

the 1.0 ebuild worked fine though...

----------

## pijalu

Since I just rebuild the tar for my previous post, could be some timing issue between my system and yours....

Retry in a few hours and tell me if it worked  :Smile: 

----------

## alien275

Hello,

I have a Sony VAIO VGN-C2S and the FN key doesn't work. I use sony_acpi driver because sonypi doesn't work for me. I can change the brightness of my screen with this command :

echo 4 > /proc/acpi/sony/brightness

After I look into the source code of sony_acpi and in my dsdt file, I find why it doesn't work. In fact,  I doesn't have the GHKE operation in my dsdt file and that's why the sony_acpi module doesn't create /proc/acpi/sony/fnfey. I try to look for an other function in my DSDT file (for FN key) but I can't find it.

Has anybody any idea how I can get the right operation or help me to find it ??

Thanks

----------

## Adwin

I'm having the same trouble with a VGN-FS980

The module builds just fine on a 2.6.21-rc3 kernel

But /proc/acpi/sony is empty.

I tried the other solutions. None work ...

----------

## |Quantum|

I have a very stupid question:

I'm using Gentoo on AMD64 on Sony VAIO FE41S.

The doc file is there, but I can't find the sonypid-driver ANYWHERE in the kernel config (not even in Drivers->Char->...).

Anyone with the same problem?

----------

## pijalu

 *Adwin wrote:*   

> I'm having the same trouble with a VGN-FS980
> 
> The module builds just fine on a 2.6.21-rc3 kernel
> 
> But /proc/acpi/sony is empty.
> ...

 

Just for info, kernel 2.6.21 now contains a new sony acpi that should contains fnkey.... did not try it yet but should work out of the box  :Smile: 

EDIT: The new module is sony_laptop but currently only the SVN version works on it (so it's not out-of-the-box yet). 

I'll do the package when I found some times

----------

## |Quantum|

OK, found stupid answer to stupid question: sonypi is *not* supported on AMD64...

----------

## G2k

Hey I haven't been around the Gentoo scene in a while, are there any updated ebuilds for fsfn? Have there been improvements on the suspend/resume dsdt things? There's an interesting post on the ubuntu forums.

----------

## pijalu

 *G2k wrote:*   

> Hey I haven't been around the Gentoo scene in a while, are there any updated ebuilds for fsfn? Have there been improvements on the suspend/resume dsdt things? There's an interesting post on the ubuntu forums.

 

Nothing really new - Kernel 2.6.21 does not require sony_acpi (sony_laptop module in 2.6.21) but does not work out of the box with "in stock" fsfn 

--> I updated the svn version of fsfn to support both old sony_acpi (for pre 2.6.21) and sony_laptop (2.6.21 and so on)

I should do an ebuild for it but I still lack time... So if you have a few hours to spend, feel free  :Wink: 

----------

## G2k

I don't know if this is what you were saying but I just read that 2.6.22-rc4 kernel includes the SONY PI sony-laptop driver. Just thought I would throw that out there.

----------

## Peach

 *pijalu wrote:*   

> I should do an ebuild for it but I still lack time... So if you have a few hours to spend, feel free 

 

I felt free and created the svn ebuild: https://bugs.gentoo.org/show_bug.cgi?id=170694

great work pijalu, you don't even know how much I hated these software-controlled fn keys. I don't think I will ever buy a vaio anymore (that's not the only reason of course).

----------

## pijalu

 *Peach wrote:*   

>  *pijalu wrote:*   I should do an ebuild for it but I still lack time... So if you have a few hours to spend, feel free  
> 
> I felt free and created the svn ebuild: https://bugs.gentoo.org/show_bug.cgi?id=170694
> 
> great work pijalu, you don't even know how much I hated these software-controlled fn keys. I don't think I will ever buy a vaio anymore (that's not the only reason of course).

 

Great and thanks to you  :Smile: 

For the software-controlled thingy I guess I know: I had the pleasure to unbox this sony laptop few years ago and see "Cool, it's not working...."

for Vaio's: Not a too bad machine [still working fine - just had to change the thermal grease in the cooling system after 1 year and cd burner not really reliable]... but already seen crapiest machines... but still... I don't plan another one  :Wink: 

----------

## Peach

you make me think that I'll need to do something for the thermalgrease thanks for the advice  :Smile: 

the cd-burner has been changed right after 1 year  :Very Happy: 

----------

## G2k

optical drive change here too after 1 year

I haven't checked the grease...should I?

----------

## pijalu

You will if a good and long emerge == auto (unclean) shutdown ... 

EDIT: more seriously, check that the temp don't go over 80c with full power and when fan starts, you should actually see the temp going down or at least stabilizing... 

The problem started after something like 6month, temp went higher and higher but I didn't care that much...(just added cpufreqd to limit the problem and lower cpu speed)..

But after 1 year, it did his first (and last) critical stop [for some reason cpufreqd was out to lunch...]

==> this decided me (and the fact that I already had another main laptop...) to review the cooling thing... 

Just take care: if you remove the cooling system, there is no "turn back" since you must put thermal grease or you will end up with a even more dangerous situation  :Smile: 

[aka: don't open without the thermal grease bottle on your side...]

----------

## G2k

Hey this has nothing to do with fsfn but it's relevant to my VAIO VGN-FS660/W: when I build a genkernel-ed kernel, the little orange light next to the power, battery and processing light turns on. I'm talking about the one that's between the WLAN on and off switch and the flickering processing light...it's like an M with three lines below it.

I don't know what this is but I don't get this in Windows XP and I don't get it when I manually configure a kernel. Do you guys know what this means? It turns on at about 1/3 into the boot process.

Thanks!

----------

## Peach

 *G2k wrote:*   

> Hey this has nothing to do with fsfn but it's relevant to my VAIO VGN-FS660/W: when I build a genkernel-ed kernel, the little orange light next to the power, battery and processing light turns on. I'm talking about the one that's between the WLAN on and off switch and the flickering processing light...it's like an M with three lines below it.
> 
> I don't know what this is but I don't get this in Windows XP and I don't get it when I manually configure a kernel. Do you guys know what this means? It turns on at about 1/3 into the boot process.
> 
> Thanks!

 

look for a sony multimedia slot. that led is there to monitor activity. as long as I know there's no support of that type of card reader under linux... but I might be wrong.

----------

## G2k

Well...it's just on. It doesn't blink or flicker. Also, it's permanently off when I manually configure the kernel. At first I thought that it turned on when there was an excessive use of RAM but conky tells me otherwise. Sony Multimedia slot? Never used...

----------

## pijalu

it's actually the memory stick bay (this is the reason why it got a nice M)... started to lit around kernel 2.6.20 if I remember well (manual config, but no clue what I enabled... I never look too deep on new function when "make oldconfig"....

Side node: it's also "on" on Ubuntu 7.04...  

btw no clue if it's "really" working  :Smile: ...

----------

## G2k

Yeah I noticed that it went "on" on Ubuntu when I tried it out some time ago. But on Windows it's off by default so I guess that's how I would like it to be  :Razz:  I'll manually compile a kernel sometime in the future so it goes off...

----------

## die-hard

hi all, 1st thanks for this tool, 2nd help me  :Smile: 

I installed all and my event is /dev/input/event2.

----------

## pijalu

Normally you don't need the sony_acpi anymore with kernel 2.6.21 and higher and the svn version support it

==> the easiest is to use the ebuild of peach (https://bugs.gentoo.org/show_bug.cgi?id=170694) [fsfn-9999.ebuild]

----------

## G2k

will it be in the official portage tree soon?

----------

## die-hard

 *pijalu wrote:*   

> Normally you don't need the sony_acpi anymore with kernel 2.6.21 and higher and the svn version support it
> 
> ==> the easiest is to use the ebuild of peach (https://bugs.gentoo.org/show_bug.cgi?id=170694) [fsfn-9999.ebuild]

 

i got spny vaio sz, i merged our ebuild but FN key is on event6 and all other keys are on event2.

What can i do?

----------

## pijalu

 *die-hard wrote:*   

> 
> 
> i got spny vaio sz, i merged our ebuild but FN key is on event6 and all other keys are on event2.
> 
> What can i do?

 

Not really sure I follow - Normally (At least on the vaio's working with fsfn), the FN key does not have a specific event and are just some specific keyboard events that fsfn translates to action on the acpi.

Out of the blue, I will be curious to see the content of /proc/bus/input/devices and see the log of fsfn (in /var/log/messages) when you load it.

----------

## die-hard

 *pijalu wrote:*   

>  *die-hard wrote:*   
> 
> i got spny vaio sz, i merged our ebuild but FN key is on event6 and all other keys are on event2.
> 
> What can i do? 
> ...

 

```

VaioTux ~ # cat /proc/bus/input/devices

I: Bus=0019 Vendor=0000 Product=0005 Version=0000

N: Name="Lid Switch"

P: Phys=PNP0C0D/button/input0

S: Sysfs=/class/input/input0

U: Uniq=

H: Handlers=event0

B: EV=21

B: SW=1

I: Bus=0019 Vendor=0000 Product=0001 Version=0000

N: Name="Power Button (CM)"

P: Phys=PNP0C0C/button/input0

S: Sysfs=/class/input/input1

U: Uniq=

H: Handlers=kbd event1

B: EV=3

B: KEY=100000 0 0 0

I: Bus=0011 Vendor=0001 Product=0001 Version=ab41

N: Name="AT Translated Set 2 keyboard"

P: Phys=isa0060/serio0/input0

S: Sysfs=/class/input/input2

U: Uniq=

H: Handlers=kbd event2

B: EV=120013

B: KEY=4 2000000 3802078 f840d001 feffffdf ffefffff ffffffff fffffffe

B: MSC=10

B: LED=7

I: Bus=0011 Vendor=0002 Product=0008 Version=0000

N: Name="PS/2 Mouse"

P: Phys=isa0060/serio1/input1

S: Sysfs=/class/input/input3

U: Uniq=

H: Handlers=mouse0 event3

B: EV=7

B: KEY=70000 0 0 0 0 0 0 0 0

B: REL=3

I: Bus=0011 Vendor=0002 Product=0008 Version=7321

N: Name="AlpsPS/2 ALPS GlidePoint"

P: Phys=isa0060/serio1/input0

S: Sysfs=/class/input/input4

U: Uniq=

H: Handlers=mouse1 event4

B: EV=f

B: KEY=420 0 70000 0 0 0 0 0 0 0 0

B: REL=3

B: ABS=1000003

I: Bus=0010 Vendor=104d Product=0000 Version=0000

N: Name="Sony Vaio Jogdial"

P: Phys=

S: Sysfs=/class/input/input5

U: Uniq=

H: Handlers=mouse2 event5

B: EV=7

B: KEY=40000 0 0 0 0 0 0 0 0

B: REL=100

I: Bus=0010 Vendor=104d Product=0000 Version=0000

N: Name="Sony Vaio Keys"

P: Phys=

S: Sysfs=/class/input/input6

U: Uniq=

H: Handlers=kbd event6

B: EV=3

B: KEY=1f ffff0000 0 20000 100000 0 2 0 0 100400 0 40300400 0 0 0 0

VaioTux ~ #

```

```

Nov 11 23:20:40 VaioTux fsfn[22719]: Loading config file /etc/fsfn.conf

Nov 11 23:20:40 VaioTux fsfn[22719]: Setting default configuration

Nov 11 23:20:40 VaioTux fsfn[22719]: Configuration: DEVICE=AUTO

Nov 11 23:20:40 VaioTux fsfn[22719]: Configuration: ALSA_NAME=Front

Nov 11 23:20:40 VaioTux fsfn[22719]: Configuration: F12_CMD=/bin/hibernate

Nov 11 23:20:40 VaioTux fsfn[22719]: Configuration: OSD_VCOLOR=red

Nov 11 23:20:40 VaioTux fsfn[22719]: Configuration: OSD_BCOLOR=blue

Nov 11 23:20:40 VaioTux fsfn[22719]: Configuration: OSD_FONT=-*-*-*-*-*-*-20-*-*-*-*-*-*-*

Nov 11 23:20:40 VaioTux fsfn[22719]: default configuration done

Nov 11 23:20:40 VaioTux fsfn[22719]: error opening config file

Nov 11 23:20:40 VaioTux fsfn[22720]: autodevice determines /dev/input/event2 as keyboard event

Nov 11 23:20:40 VaioTux fsfn[22720]: fsfn loaded

```

i have not fsfn.conf in /etc

----------

## pijalu

hmm....

Your laptop seems to support sonypi, so I don't think that fsfn is really the tools you need...

You can still give a shot to modprobe sony-laptop and check that you see this entry:

```

/sys/devices/platform/sony-laptop/fnkey

```

* If no: Then your laptop is not supported since this is the current way fsfn decode the FN keystroke... and since I don't own a comparable system, you are sadly left alone on this  :Sad: 

* If yes: you can still force fsfn to use input6 via the /etc/fsfn.conf and the entry

```

DEVICE=/dev/event6

```

But I really don't think this will really works... I guess you should try to get some info on sonypi and the possible ways to handle the FN keys

----------

## die-hard

hi man my laptop support sonypi very well, but i don't know to configure script acpi default.sh. Can u help me in this ?

----------

## pijalu

for sonypi I will have to pass...

----------

## G2k

with the new portage versions (2.1.4.4) there's a problem with the manifest for the fsfn overlay. Does someone know how to fix this?

Also, I compiled my kernel (gentoo-sources-2.6.23-r8 ) with

Symbol: SONYPI_COMPAT [=y]

Symbol: SONY_LAPTOP [=y]

Symbol: SONYPI [=n]

So I thought I would somehow be able to use the fn keys by default but apparently that's not the case. Any clue as to what these things do?

----------

## pijalu

What ebuild are you using ?

The only one that should works with newer kernel is the 9999 by peach, other versions only supported sony_acpi

----------

## G2k

I was using app-laptop/fsfn-1.0 with kernel 2.6.22 but now I'm using 2.6.23-r8. How would I install the 9999 version? Also, what are those Sony things I mentioned above that I enabled in my kernel for if not for the screen brightness?

EDIT:

This is what I compiled

```
# cat /usr/src/linux/.config | grep SONY

CONFIG_SONY_LAPTOP=y

CONFIG_SONYPI_COMPAT=y

CONFIG_SONYPI=y
```

I found this link which sort of explains it, but I haven't figured out how to use it yet. If I do I will let you guys know.

----------

## pijalu

you should download the ebuild that peach posted on the previous page, put it in your overlay, digest it (ebuild fsfn-9999.ebuild digest) and emerge it.

The sonypi is a way to control brightness, but requires a specific controller in your vaio, and at least for the FS series, this controller is not present (that was the point of fsfn and the sony acpi module  :Smile:  ) - Now, the newest kernels comes with this module ... But the interface with user world is a little bit different from the "old" sony acpi....

I had to update fsfn to support it (this is why you need to use the "svn" version...aka 9999 - The good news is this version is smart enough to work with both, so if you boot with an "old" kernel [xen for e.g.] where the module is not present, you can still use the old module with this specific version and fsfn will still do his job...)

----------

## G2k

Thanks, I'm emerging now.

Why does it pull in subversion as a dependency?

----------

## pijalu

Because you need subversion to fetch the source code  :Smile: 

----------

## G2k

 *pijalu wrote:*   

> Because you need subversion to fetch the source code 

   :Confused:  that kind of stinks.

Anyway, I just wanted to point out that to get fsfn working automatically in graphics mode (aka wtih xosd) the binary is no longer /usr/local/bin/fsfn but /usr/bin/fsfn, so if you're using GNOME then go to System -> Preferences -> Sessions -> Edit or Add an entry for FSFN and set the command to /usr/bin/fsfn -o

----------

## barlad

fsfn does not work on my laptop (sony SZ serie) and I am wondering a few things.

- I am using the latest sony-laptop driver from 2.6.24 and everything related to FN keys seem to work fine: there is an input device created to which is redirected all the FN keystrokes, and those FN strokes are even forwarded to the acpid daemon as acpi events. The only thing I do not have is a fnkey device in /sys/devices/platform/sony-laptop/fnkey . Why don't I have this fnkey device if everything seems to work fine? Is this a problem with the sony-laptop driver?

- My second question is what's the point of this fnkey device anyway? It was my understanding that fsfn works by reading keystrokes from the input device (/dev/input/eventX) and using it to set up brightness or volume or whatever. What's the role played by the fnkey device in this?

I guess I am not hopeless to get a use of my fn keys since I can use acpid rules for them but I would be much happier with fsfn :/

Thanks for all the help!

----------

## G2k

I was looking through my dmesg and I noticed the following lines

```
sonypi: Sony Programmable I/O Controller Driver v1.26.

sonypi: please try the sony-laptop module instead and report failures, see also http://www.linux.it/~malattia/wiki/index.php/Sony_drivers

sonypi: detected type3 model, verbose = 0, fnkeyinit = off, camera = off, compat = off, mask = 0xffffffff, useinput = on, acpi = on

sonypi: enabled at irq=11, port1=0x1080, port2=0x1084

sonypi: device allocated minor is 63

input: Sony Vaio Jogdial as /class/input/input0

input: Sony Vaio Keys as /class/input/input1

sonypi command failed at drivers/char/sonypi.c : sonypi_call1 (line 652)

sonypi command failed at drivers/char/sonypi.c : sonypi_call2 (line 663)

sonypi command failed at drivers/char/sonypi.c : sonypi_call2 (line 665)

sonypi command failed at drivers/char/sonypi.c : sonypi_call1 (line 652)
```

Why are all those commands failing towards the bottom? I read that it might have something to do with xbacklight but I dont really know what I should make of that.

----------

## pijalu

 *barlad wrote:*   

> fsfn does not work on my laptop (sony SZ serie) and I am wondering a few things.
> 
> - I am using the latest sony-laptop driver from 2.6.24 and everything related to FN keys seem to work fine: there is an input device created to which is redirected all the FN keystrokes, and those FN strokes are even forwarded to the acpid daemon as acpi events. The only thing I do not have is a fnkey device in /sys/devices/platform/sony-laptop/fnkey . Why don't I have this fnkey device if everything seems to work fine? Is this a problem with the sony-laptop driver?
> 
> 

 

It's quite probable that your ACPI just does not work as the old fs series, and it seems to use something different  :Sad: 

 *Quote:*   

> 
> 
> - My second question is what's the point of this fnkey device anyway? It was my understanding that fsfn works by reading keystrokes from the input device (/dev/input/eventX) and using it to set up brightness or volume or whatever. What's the role played by the fnkey device in this?
> 
> 

 

The FS serie (and a few others) used this device to get the actual key you pressed - For some reason, when you hit the FN+something, the hardware always return same "key", and the actual value of the function was set in ACPI... The fnkey was just the userspace entry to this memory

==> If you don't have it, it just means that your hardware does not use the same principle...

 *Quote:*   

> 
> 
> I guess I am not hopeless to get a use of my fn keys since I can use acpid rules for them but I would be much happier with fsfn :/
> 
> Thanks for all the help!

 

It's open source, so nothing stop you from changing/updating FSFN to support the handling of your laptop  :Smile: 

I would like to do it, but sadly I don't own such laptop and I am a little bit running behind time to do it only with feedback  :Smile: 

----------

## Peach

hi pijalu. did you already tried fsfn with pulseaudio? I'm currently possessing a USB SoundBlaster-live! (awful support btw) and got serious improvements using pulseaudio, but now the only key working is the light but not the audio. If you need any output just ask.

----------

## pijalu

 *Peach wrote:*   

> hi pijalu. did you already tried fsfn with pulseaudio? I'm currently possessing a USB SoundBlaster-live! (awful support btw) and got serious improvements using pulseaudio, but now the only key working is the light but not the audio. If you need any output just ask.

 

Nope... mostly because I don't have a Gentoo on this laptop anymore [I moved that old baby to Ubuntu since I only start once a month  :Smile:  - Gentoo is just for my "main" machine  :Smile:  ]

==> Will take a look one of these days but not really a first priority  :Smile: 

----------

## VinnieNZ

Hi pijalu,

I was wondering if you could give me hand in getting fsfn svn working with the sony-laptop driver on my VGN-FS35GP.

I've been through the whole thread, and everything appears to be where it should be and I have the devices I think, yet when I press the Fn buttons, nothing seems to happen.  I get the:

```
Apr 14 17:43:10 gallardo atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:43:10 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

Apr 14 17:43:10 gallardo atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:43:10 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.
```

errors that G2K got at the very start of this thread, but nothing happens.

I can echo the brightness level out to /sys/class/backlight/sony/brightness and it changes, so nothing wrong there, and I've ensured that the hotkeys are set to Type 1 in the BIOS.  I've also checked that /sys/devices/platform/sony-laptop/fnkey exists (it contains the value '31' if it makes a difference).

I've included some info (based on what you have previously asked for, I'm happy to provide more) in the hope you can spot something:

```
gallardo ~ # cat /proc/bus/input/devices

I: Bus=0019 Vendor=0000 Product=0002 Version=0000

N: Name="Power Button (FF)"

P: Phys=LNXPWRBN/button/input0

S: Sysfs=/class/input/input0

U: Uniq=

H: Handlers=kbd event0

B: EV=3

B: KEY=100000 0 0 0

I: Bus=0019 Vendor=0000 Product=0005 Version=0000

N: Name="Lid Switch"

P: Phys=PNP0C0D/button/input0

S: Sysfs=/class/input/input1

U: Uniq=

H: Handlers=event1

B: EV=21

B: SW=1

I: Bus=0019 Vendor=0000 Product=0001 Version=0000

N: Name="Power Button (CM)"

P: Phys=PNP0C0C/button/input0

S: Sysfs=/class/input/input2

U: Uniq=

H: Handlers=kbd event2

B: EV=3

B: KEY=100000 0 0 0

I: Bus=0011 Vendor=0001 Product=0001 Version=abba

N: Name="AT Translated Set 2 keyboard"

P: Phys=isa0060/serio0/input0

S: Sysfs=/class/input/input3

U: Uniq=

H: Handlers=kbd event3

B: EV=120013

B: KEY=4 2000000 3803078 f800d001 feffffdf ffefffff ffffffff fffffffe

B: MSC=10

B: LED=7

I: Bus=0011 Vendor=0002 Product=0008 Version=0000

N: Name="PS/2 Mouse"

P: Phys=isa0060/serio4/input1

S: Sysfs=/class/input/input4

U: Uniq=

H: Handlers=mouse0 event4

B: EV=7

B: KEY=70000 0 0 0 0 0 0 0 0

B: REL=3

I: Bus=0011 Vendor=0002 Product=0008 Version=7321

N: Name="AlpsPS/2 ALPS GlidePoint"

P: Phys=isa0060/serio4/input0

S: Sysfs=/class/input/input5

U: Uniq=

H: Handlers=mouse1 event5

B: EV=f

B: KEY=420 0 70000 0 0 0 0 0 0 0 0

B: REL=3

B: ABS=1000003

I: Bus=0010 Vendor=104d Product=0000 Version=0000

N: Name="Sony Vaio Keys"

P: Phys=

S: Sysfs=/class/input/input10

U: Uniq=

H: Handlers=kbd event6 rfkill

B: EV=13

B: KEY=1f 3fff0000 0 0 100000 0 2 0 6000 100400 0 40300400 0 0 0 0

B: MSC=10

I: Bus=0010 Vendor=104d Product=0000 Version=0000

N: Name="Sony Vaio Jogdial"

P: Phys=

S: Sysfs=/class/input/input11

U: Uniq=

H: Handlers=mouse2 event7

B: EV=7

B: KEY=40000 0 0 0 0 0 0 0 0

B: REL=100

```

```
gallardo ~ # ls /dev/input/

by-path  event0  event1  event2  event3  event4  event5  event6  event7  mice  mouse0  mouse1  mouse2

```

```

Apr 14 17:50:08 gallardo fsfn[4094]: Setting default configuration

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: DEVICE=AUTO

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: ALSA_NAME=Front

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: SOUND_STEP=10

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: F12_CMD=/bin/hibernate

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: OSD_VCOLOR=red

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: OSD_VCOLORZ=red

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: OSD_BCOLOR=blue

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: OSD_FONT=-*-*-*-*-*-*-20-*-*-*-*-*-*-*

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: OSD_TIMEOUT=3

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: BRT_SETDEFAULT=0

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: BRT_HACK_FJS=0

Apr 14 17:50:08 gallardo fsfn[4094]: Using sony-laptop subsystem

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: BRIGHTNESS_DEVICE=/sys/class/backlight/sony/brightness

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: BRIGHTNESS_DEFAULT_DEVICE=/sys/devices/platform/sony-laptop/brightness_default

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: FNKEY_DEVICE=/sys/devices/platform/sony-laptop/fnkey

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: BRIGHTNESS_MAX=7

Apr 14 17:50:08 gallardo fsfn[4094]: Configuration: BRIGHTNESS_MIN=0

Apr 14 17:50:08 gallardo fsfn[4094]: default configuration done

Apr 14 17:50:08 gallardo fsfn[4094]: Loading config file /etc/fsfn.conf

Apr 14 17:50:08 gallardo fsfn[4094]: error opening config file: No such file or directory

Apr 14 17:50:08 gallardo fsfn[4094]: autodevice determines /dev/input/event3 as keyboard event

Apr 14 17:50:08 gallardo fsfn[4094]: fsfn loaded

Apr 14 17:50:12 gallardo atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:50:12 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

Apr 14 17:50:12 gallardo atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:50:12 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

Apr 14 17:50:12 gallardo atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:50:12 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

Apr 14 17:50:12 gallardo atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:50:12 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

Apr 14 17:50:13 gallardo atkbd.c: Unknown key pressed (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:50:13 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.

Apr 14 17:50:13 gallardo atkbd.c: Unknown key released (translated set 2, code 0xf5 on isa0060/serio0).

Apr 14 17:50:13 gallardo atkbd.c: Use 'setkeycodes e075 <keycode>' to make it known.
```

----------

## pijalu

 *VinnieNZ wrote:*   

> Hi pijalu,
> 
> [snip]
> 
> I can echo the brightness level out to /sys/class/backlight/sony/brightness and it changes, so nothing wrong there, and I've ensured that the hotkeys are set to Type 1 in the BIOS.  I've also checked that /sys/devices/platform/sony-laptop/fnkey exists (it contains the value '31' if it makes a difference).
> ...

 

Hmm... the "log error" is normal, just the kernel kb bitching since it does not know the meaning of the key and does not harm...

What I am more interested in is this "fnkey" value... Normally, for every FN+(function key) you press the value should change, and after 1 "cat" of it, it should become 0

==> Can you check this is also the case for your laptop ?

----------

## VinnieNZ

Ahh yes.  Sorry that is exactly the case.

Pressing Fn+Vol- gives a value when cat'd of 4.  Cat'ing again and it returns to 0.

So any idea why fsfn wouldn't work?

----------

## G2k

So i've installed OpenRC and baselayout 2, but the module doesn't load. Right now I have

```
modules_2_6="${modules_2_6} nvidia"

module_nvidia_args_2_6=""

modules_2_6="${modules_2_6} ipw2200 sony_acpi"

module_ipw2200_args_2_6=""

module_sony_acpi_args_2_6=""
```

Do I have to load it with another name?

----------

## bugax

Hi to all,

First of all, i'm a newbie. I've a sony vaio VGN-A217M and I'm using kernel 2.6.24-gentoo-r4 with

```

# grep "SONY" .config

CONFIG_SONY_LAPTOP=m

CONFIG_SONYPI_COMPAT=y

# CONFIG_SONYPI is not set

#

```

when i run

```

# modprobe sony-laptop

# dmesg

sony-laptop: Sony Programmable IO Control Driver v0.5.

sony-laptop: detected Type2 model

input: Sony Vaio Keys as /class/input/input18

input: Sony Vaio Jogdial as /class/input/input19

sony-laptop: device allocated minor is 61

sony-laptop: Sony Notebook Control Driver v0.5.

# ls /dev/input/

by-id    event0  event2  event4  event6  mice    mouse1  mouse3

by-path  event1  event3  event5  event7  mouse0  mouse2

# ls /sys/devices/platform/sony-laptop/

bluetoothpower      bus     fanspeed  power      uevent

brightness_default  driver  modalias  subsystem  wwanpower

```

obviously fnkeys do not work at all.

help   :Confused: 

bye

----------

## G2k

have you tried using the fsfn script?

----------

## bugax

I've emerged sony_acpi and fsfn via portage overlay but nothing happens.

I run the script and I got 

```

SonyFN loaded

Error opening /proc/acpi/sony/fnkey: No such file or directory

```

I hope this is useful

```

# grep "ACPI" .config

CONFIG_ACPI=y

CONFIG_ACPI_SLEEP=y

CONFIG_ACPI_PROCFS=y

CONFIG_ACPI_PROCFS_POWER=y

CONFIG_ACPI_SYSFS_POWER=y

CONFIG_ACPI_PROC_EVENT=y

CONFIG_ACPI_AC=y

CONFIG_ACPI_BATTERY=y

CONFIG_ACPI_BUTTON=y

CONFIG_ACPI_FAN=y

# CONFIG_ACPI_DOCK is not set

CONFIG_ACPI_PROCESSOR=y

CONFIG_ACPI_THERMAL=y

# CONFIG_ACPI_ASUS is not set

# CONFIG_ACPI_TOSHIBA is not set

CONFIG_ACPI_BLACKLIST_YEAR=0

# CONFIG_ACPI_DEBUG is not set

CONFIG_ACPI_EC=y

CONFIG_ACPI_POWER=y

CONFIG_ACPI_SYSTEM=y

# CONFIG_ACPI_CONTAINER is not set

# CONFIG_ACPI_SBS is not set

# CONFIG_X86_ACPI_CPUFREQ is not set

# CONFIG_HOTPLUG_PCI_ACPI is not set

CONFIG_PNPACPI=y

# CONFIG_THINKPAD_ACPI is not set

# CONFIG_BLK_DEV_IDEACPI is not set

CONFIG_ATA_ACPI=y

# CONFIG_PATA_ACPI is not set

```

any suggestions?

thx

----------

## fbcyborg

Hi bugax, try to download sony_acpi from here.

Compile it and copy sony_acpi.ko into the /lib/modules/`uname -r`/kernel/drivers/acpi directory.

```
depmod -a

modprobe sony_acpi
```

Now, you should have the directory you're missing.

Bye.

----------

## QuimaxW

Sony VGN FS742/W. running xorg 1.5, which likes to load the evdev driver for everything. If I uninstall the xf86-input-evdev from my system, then the FN keys work fine with the kbd driver.

If there a way to get the FSFN and evdev to get along?

----------

## fbcyborg

Hello!

I've just reinstalled Gentoo on my laptop.

It was a 32bit distribution before. Now I reinstalled the whole system as 64bit binaries.

Prior installing the new system, I was running KDE 3.5 using Fn keys very well.

At the moment I'm not able to capture Fn events anymore.

For example, I should be able to see something in /var/log/message, when pressing Fn+f2.

It doesn't appear anything instead.

These are the modules I compiled, about SONY:

```
CONFIG_HID_SONY=y

CONFIG_SONY_LAPTOP=y

CONFIG_SONYPI_COMPAT=y
```

What am I missing?

----------

## fbcyborg

^^UP^^

----------

