# Fn keys don't work on a sony laptop

## foulmetal

Hi,

I own a Sony VAIO PCG-K115B, almost everything works but Fn keys (aka hotkeys).

I use sony-laptop module to make them work and it reports me that it uses 2 input devices :

```
# modprobe sony-laptop debug=1

sony-laptop: Sony Notebook Control Driver v0.6.

sony-laptop: method: name: GBRT, args 0

sony-laptop: method: name: SBRT, args 1

sony-laptop: method: name: GPBR, args 0

sony-laptop: method: name: SPBR, args 1

sony-laptop: method: name: GCMI, args 1

sony-laptop: method: name: SCMI, args 1

sony-laptop: method: name: CSXB, args 1

sony-laptop: method: name: STCS, args 1

sony-laptop: method: name: GHKE, args 0

input: Sony Vaio Keys as /class/input/input15

input: Sony Vaio Jogdial as /class/input/input16

sony-laptop: Found brightness_default getter: GPBR

sony-laptop: Found brightness_default setter: SPBR

sony-laptop: Found fnkey getter: GHKE

sony-laptop: Found CMI getter: GCMI

sony-laptop: Found CMI setter: SCMI
```

As you can see hotkeys are attached to input15 and input15 is mapped to event6 device (ls /sys/class/input/input15/ tells me)

Then I want to look if hotkeys are handled, 2 solutions :

```
# cat /dev/input/event6
```

or

```
# cat /proc/acpi/event
```

Nothing happens, when I hit any hotkeys.

Here what reports kernel log :

```
Aug  2 12:01:13 vagyo atkbd.c: Unknown key pressed (translated set 2, code 0xf7 on isa0060/serio0).

Aug  2 12:01:13 vagyo atkbd.c: Use 'setkeycodes e077 <keycode>' to make it known.
```

It's the same code 0xf7 for each hotkeys.

The strangest thing, is that I've got the fnkey file in /sys/devices/platform/sony-laptop/ and when I press some hotkeys value changes into this file :

```
# ls /sys/devices/platform/sony-laptop/

CMI                 driver/             power/              

brightness_default  fnkey               subsystem/          

bus/                modalias            uevent
```

(Changing LCD brightness works via echo into the /sys/class/backlight/sony/brightness)

So, what the matter?

Please help.

----------

## pijalu

from your explanations, look like the svn version of fsfn maybe of some interests

https://bugs.gentoo.org/show_bug.cgi?id=170694

and the fsfn "topic"

https://forums.gentoo.org/viewtopic-p-4051367.html#4051367

edit: You may have to do some "update" on it to get work - I wrote that too long ago to remember the full thing

----------

## foulmetal

I've installed the last svn version (rev 56), but it doesn't work at all.

When I lauched fsfn, here what I see in the log :

```
Aug 15 13:52:02 vagyo fsfn[5626]: Setting default configuration

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: DEVICE=AUTO

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: ALSA_NAME=Front

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: SOUND_STEP=10

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: F12_CMD=/bin/hibernate

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: OSD_VCOLOR=red

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: OSD_VCOLORZ=red

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: OSD_BCOLOR=blue

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: OSD_FONT=-*-*-*-*-*-*-20-*-*-*-*-*-*-*

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: OSD_TIMEOUT=3

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: BRT_SETDEFAULT=0

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: BRT_HACK_FJS=0

Aug 15 13:52:02 vagyo fsfn[5626]: Using sony-laptop subsystem

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: BRIGHTNESS_DEVICE=/sys/class/backlight/sony/brightness

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: BRIGHTNESS_DEFAULT_DEVICE=/sys/devices/platform/sony-laptop/brightness_default

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: FNKEY_DEVICE=/sys/devices/platform/sony-laptop/fnkey

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: BRIGHTNESS_MAX=7

Aug 15 13:52:02 vagyo fsfn[5626]: Configuration: BRIGHTNESS_MIN=0

Aug 15 13:52:02 vagyo fsfn[5626]: default configuration done

Aug 15 13:52:02 vagyo fsfn[5626]: Loading config file /etc/fsfn.conf
```

with the -d /dev/input/event6 which is the "Sony Vaio Keys" for instance

with the --nodaemon switch, the command fsfn exits just after…

And my Vaio isn't a [FS] series at all…

----------

## pijalu

Did you run it as root ?

and can you run it without any "option" to see what the auto discovery finds out ?

----------

## foulmetal

Ooops didn't run as root

running fsfn as root, here is log :

```
Aug 15 16:50:26 vagyo fsfn[10039]: Setting default configuration

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: DEVICE=AUTO

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: ALSA_NAME=Front

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: SOUND_STEP=10

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: F12_CMD=/bin/hibernate

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: OSD_VCOLOR=red

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: OSD_VCOLORZ=red

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: OSD_BCOLOR=blue

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: OSD_FONT=-*-*-*-*-*-*-20-*-*-*-*-*-*-*

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: OSD_TIMEOUT=3

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: BRT_SETDEFAULT=0

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: BRT_HACK_FJS=0

Aug 15 16:50:26 vagyo fsfn[10039]: Using sony-laptop subsystem

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: BRIGHTNESS_DEVICE=/sys/class/backlight/sony/brightness

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: BRIGHTNESS_DEFAULT_DEVICE=/sys/devices/platform/sony-laptop/brightness_default

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: FNKEY_DEVICE=/sys/devices/platform/sony-laptop/fnkey

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: BRIGHTNESS_MAX=7

Aug 15 16:50:26 vagyo fsfn[10039]: Configuration: BRIGHTNESS_MIN=0

Aug 15 16:50:26 vagyo fsfn[10039]: default configuration done

Aug 15 16:50:26 vagyo fsfn[10039]: Loading config file /etc/fsfn.conf

Aug 15 16:50:26 vagyo fsfn[10040]: autodevice determines /dev/input/event1 as keyboard event

Aug 15 16:50:26 vagyo fsfn[10039]: Error deleting queue: Invalid argument

Aug 15 16:50:26 vagyo fsfn[10040]: fsfn loaded
```

As you can see, there is an error :

```
Aug 15 16:50:26 vagyo fsfn[10040]: autodevice determines /dev/input/event1 as keyboard event

Aug 15 16:50:26 vagyo fsfn[10039]: Error deleting queue: Invalid argument
```

event1 isn't the right device, 'cause sony-laptop reports me another device for hotkeys :

```
Aug 15 12:36:47 vagyo sony-laptop: Sony Notebook Control Driver v0.6.

Aug 15 12:36:47 vagyo input: Sony Vaio Keys as /class/input/input6

Aug 15 12:36:47 vagyo input: Sony Vaio Jogdial as /class/input/input7
```

input6 refers to event6

```
# ls /sys/class/input6

capabilities/ event6/       input:event6/ name          power/        uevent        

device/       id/           modalias      phys          subsystem/    uniq          

```

```
# fsfn -d /dev/input/event6
```

```
Aug 15 16:59:23 vagyo fsfn[10261]: Setting default configuration

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: DEVICE=AUTO

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: ALSA_NAME=Front

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: SOUND_STEP=10

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: F12_CMD=/bin/hibernate

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: OSD_VCOLOR=red

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: OSD_VCOLORZ=red

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: OSD_BCOLOR=blue

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: OSD_FONT=-*-*-*-*-*-*-20-*-*-*-*-*-*-*

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: OSD_TIMEOUT=3

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: BRT_SETDEFAULT=0

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: BRT_HACK_FJS=0

Aug 15 16:59:23 vagyo fsfn[10261]: Using sony-laptop subsystem

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: BRIGHTNESS_DEVICE=/sys/class/backlight/sony/brightness

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: BRIGHTNESS_DEFAULT_DEVICE=/sys/devices/platform/sony-laptop/brightness_default

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: FNKEY_DEVICE=/sys/devices/platform/sony-laptop/fnkey

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: BRIGHTNESS_MAX=7

Aug 15 16:59:23 vagyo fsfn[10261]: Configuration: BRIGHTNESS_MIN=0

Aug 15 16:59:23 vagyo fsfn[10261]: default configuration done

Aug 15 16:59:23 vagyo fsfn[10261]: Loading config file /etc/fsfn.conf

Aug 15 16:59:23 vagyo fsfn[10261]: fsfn loaded
```

No errors.

Trying to set the brightness (Fn + F4 and F5), nothing happens in either case…

----------

## pijalu

 *foulmetal wrote:*   

> 
> 
> As you can see, there is an error :
> 
> ```
> ...

 

The queue one should not be deadly - queue are only used for communication between the daemon and a XOSD client - as long as the no-daemon does not exit anymore

 *foulmetal wrote:*   

> 
> 
> event1 isn't the right device, 'cause sony-laptop reports me another device for hotkeys :
> 
> 

 

You are wrong  :Wink:  - The event that fsfn is speaking of is actually the keyboard - with my old vaio, the keypress on fn+xxx did not trigger any event, so instead of pooling, fsfn check if some keys are pressed on the keyboard

==> The event should be your keyboard and in theory, FSFN should determine it correctly

I guess this didn't work, so you may need to 

* go in the bios and check the event hotkey types

* Check the actual result in .../fnkey entry, for each "FN+XXX" and write down the value after each press (do a "cat" of the device)

On my old baby, FN+F1 gives 1, FN+F2=2, and so on

(After each press, a cat will give the value and reset it to 0)

You can find my definition in src/generics.h file, if you don't match with any of the "fn key type" from your bios, you will need to recompile fsfn with the --enable-moreconf at the ./configure step - and add the value of this key in /etc/fsfn.conf - see "man 5 fsfn" for more details on how to do this

----------

## foulmetal

w00t, it works now!

In my bios, the hotkey event type was 3, I change back to 1 value (I changed it meanwhile).

No need to do anything else…

I do a setkeycodes in order to see no more "insults" from the kernel   :Wink: 

I though fsfn was just a frontend to hotkeys recognized as "Vaio Keys" by sony-laptop module (detected as event6 device)…

But, if I understand well, fsfn detects if there is any event on the "normal" keyboard and check if the sys file fnkey has changed his state.

Thanks a lot man   :Very Happy: 

PS : I'm not a gentoo user (don't hit me!   :Rolling Eyes:  not anymore since 4 years, I'm using ArchLinux now), I didn't find any solution on other forums…

----------

## pijalu

 *foulmetal wrote:*   

> 
> 
> snip
> 
> But, if I understand well, fsfn detects if there is any event on the "normal" keyboard and check if the sys file fnkey has changed his state.
> ...

 

You got it

 *foulmetal wrote:*   

> 
> 
> Thanks a lot man  
> 
> PS : I'm not a gentoo user (don't hit me!   not anymore since 4 years, I'm using ArchLinux now), I didn't find any on other forums…

 

Happy to see it worked

And as long it's free software, I don't mind  :Smile: 

----------

## ld50

fnfs worked with me, i have a vaio VGN-FJ3S/w

----------

## QuimaxW

 *pijalu wrote:*   

>  *foulmetal wrote:*   
> 
> snip
> 
> But, if I understand well, fsfn detects if there is any event on the "normal" keyboard and check if the sys file fnkey has changed his state.
> ...

 

Sorry...I'm also on Archlinux, but this is as close as I seem to be able to find for fsfn support. We've established that fsfn detect an event on the "normal" keyboard (ie xf86-input-kbd driver I assume). Arch being more bleeding edge is moving to Xorg server 1.5. This is forcing the evdev driver to load. The last upgrade, I was able to just uninstall the evdev driver and all was well. This upgrade it won't load the kbd driver. This may be a different bug entirely, so on to my question...

Is there a way that fsfn can use the evdev driver that everything seems to be drifting towards? My limited understanding is the evdev actually gets between the calls and the RAW device as well. This seems to cause the function keys to only work outside of X. If I switch to a terminal, all works, but back to X and nothing.

----------

