Changing brightness on a Sony Vaio laptop

Solution 1:

The solution for me was to edit the /etc/X11/xorg.conf file. It's a problem with the graphics driver not the keymap.

Open the file for editing and add the line

Option     "RegistryDwords" "EnableBrightnessControl=1"

in the Section "Device" section as shown below.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option     "RegistryDwords" "EnableBrightnessControl=1"
    Option     "NoLogo" "True"
EndSection

Solution 2:

These shortcuts are controlled by the udev subsystem.

In technical terms, all shortcuts are defined in /lib/udev/keymaps. For example, for a standard Sony laptops, the file is /lib/udev/keymaps/module-sony (new Sony laptops).

0x06 mute # Fn+F2
0x07 volumedown # Fn+F3
0x08 volumeup # Fn+F4
0x09 brightnessdown # Fn+F5
0x0A brightnessup # Fn+F6
0x0B switchvideomode # Fn+F7
0x0E zoom # Fn+F10
0x10 suspend # Fn+F12

For your case you may have to create a module-mysony and add any changes there.

The link between laptop model and shortcut details is the file /lib/udev/rules.d/95-keymap.rules. Currently, there are two rules, for newer and older Sony laptops,

ENV{DMI_VENDOR}=="Sony*", KERNELS=="input*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony"

# Older Vaios have some different keys
ENV{DMI_VENDOR}=="Sony*", ATTR{[dmi/id]product_name}=="*PCG-C1*|*PCG-K25*|*PCG-F1*|*PCG-F2*|*PCG-F3*|*PCG-F4*|*PCG-F5*|*PCG-F6*|*PCG-FX*|*PCG-FRV*|*PCG-GR*|*PCG-TR*|*PCG-NV*|*PCG-Z*|*VGN-S360*|*VGN-SZ2HP_B*", ATTRS{name}=="Sony Vaio Keys", RUN+="keymap $name module-sony-old"