Trying to fix multimedia keys on Toshiba Satellite S75D

Questions about hardware,drivers and peripherals
Forum rules
Before you post please read how to get help
tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Mon Dec 16, 2013 2:49 pm

Hi everyone,

This is the first time I post something here. I have installed a dual Linux Mint 16 Petra KDE / Windows 8.1 on my Toshiba Satellite S75D laptop and I am happy to say that almost everything worked of the box on mint but the multimedia keys. After some research and palying with xev and xmodmap commands, I found that there is a mix up with the key codes and decided to try to fix it.

Here is the keyboard multimedia keys layout and expected key behavior

Code: Select all

┌─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────┬─────────────┐
│ ESC │ ?   │ ↓ ☀ │ ↑ ☼ │ □/□ │ ■/⌧ │ |◄◄ │ ►/||│ ►►| │ - ♬ │ + ♬ │ ♬/✖ │ «⊥» │ Scroll Lock │
│     │ F1  │ F2  │ F3  │ F4  │ F5  │ F6  │ F7  │ F8  │ F9  │ F10 │ F11 │ F12 │   Insert    │
└─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────┴─────────────┘    (Here goes some other keys that doesn't matter right now)

┌────────────────┬────────────────────────────────────────────────┐
│                │                  Expected Behavior             │
│ Multimedia Key ├─────────────────┬───────────────────────┬──────┤
│                │ Description     │ Key                   │ Code │
├────────────────┼─────────────────┼───────────────────────┼──────┤
│      FN+F1     │ Help            │  -                    │ -    │
│      FN+F2     │ Less Brightness │ XF86MonBrightnessDown │ 232  │
│      FN+F3     │ More Brightness │ XF86MonBrightnessUp   │ 233  │
│      FN+F4     │ Display         │ XF86Display           │ 235  │
│      FN+F5     │ Touchpad On/Off │ XF86TouchpadToggle    │ 199  │
│      FN+F6     │ Previous Audio  │ XF86AudioPrev         │ 173  │
│      FN+F7     │ Play/Pause      │ XF86AudioPlay         │ 172  │
│      FN+F8     │ Next Audio      │ XF86AudioNext         │ 171  │
│      FN+F9     │ Less Volume     │ XF86AudioLowerVolume  │ 122  │
│      FN+F10    │ More Volume     │ XF86AudioRaiseVolume  │ 123  │
│      FN+F11    │ Unmute/Mute     │ XF86AudioMute         │ 121  │
│      FN+F12    │ Wifi On/Off     │ XF86WLAN              │ 246  │ (EDIT: I found the wifi code :D)
└────────────────┴─────────────────┴───────────────────────┴──────┘
And here is the current behavior:

Code: Select all

┌────────────────┬────────────────────────────────────────────────┐
│                │                  Current Behavior              │
│ Multimedia Key ├─────────────────┬───────────────────────┬──────┤
│                │ Description     │ Key                   │ Code │
├────────────────┼─────────────────┼───────────────────────┼──────┤
│      FN+F1     │ Help            │  -                    │ -    │
│      FN+F2     │ Battery         │ XF86Battery           │ 244  │
│      FN+F3     │ Sleep           │ XF86Sleep             │ 150  │
│      FN+F4     │ Suspend         │ XF86Suspend           │ 213  │
│      FN+F5     │ Display         │ XF86Display           │ 235  │
│      FN+F6     │ Previous Audio  │ XF86AudioPrev         │ 173  │
│      FN+F7     │ Play/Pause      │ XF86AudioPlay         │ 172  │
│      FN+F8     │ Next Audio      │ XF86AudioNext         │ 171  │
│      FN+F9     │ Less Volume     │ XF86AudioLowerVolume  │ 122  │
│      FN+F10    │ More Volume     │ XF86AudioRaiseVolume  │ 123  │
│      FN+F11    │ No Simbol       │ -                     │ 248  │
│      FN+F12    │ No Simbol       │ -                     │ 248  │
└────────────────┴─────────────────┴───────────────────────┴──────┘
F1, and F6 to F10 are ok but the other ones are kind of mixed and using different key codes so I tried to create a ".Xmodmap" file to fix the key mapping and then use xmodmap commad to test it which kind of worked, but F11 and F12 has keep using the same key code and F2 and F3 also trigger F5 action for some reason so the issue keep going. After that, I put the partial fix file on my home folder and add an entry to the init file but doesn't work, then create "Xmodmap" file on "/etc/X11" and modify XSession file, and even creating an startup script to execute on startup using KDE System Preference but none of these worked either.

I think it is a keyboard layout or kernel issue more than a X configuration issue right now, so after that fail, I changed my approach and I have been researching and trying to create a xkb file (on "/usr/share/X11/xkb/symbols/") to define a custom keyboard layout and then use it with xkb as a fix but no success far now... here is my code:

Code: Select all

default
xkb_symbols "toshiba_s65d" {
    //name[Group1]= "Toshiba S75D (English US, international with dead keys)";

    include "us(intl)";
    //key.type = "ONE_LEVEL";
    key 122 { [ XF86AudioLowerVolume ] };
    key 123 { [ XF86AudioRaiseVolume ] };
    key 248 { [ XF86AudioMute ] };
    key 213 { [ XF86Display ] };
    key 235 { [ XF86TouchpadToggle ] };
    key 244 { [ XF86MonBrightnessDown ] };
    key 150 { [ XF86MonBrightnessUp ] };
    
    include "keypad";
};
I will keep trying to fix this but right now I am kind of burned out after 14 hours of non stopping research and "try and error" approach soooo... Does anyone knows how to create a xkb file or a way to fix the multmedia keys with this kind of issue? :lol:

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Wed Dec 25, 2013 12:25 am

Here I come with some updates :)

I finally figure out what is wrong with the function keys on my laptop. The problem is that Toshiba use a custom input device to manage those extra multimedia keys (the ones on F2, F3, F4, F5, F11 and F12) and it is recognized as "Toshiba input device" by udev and evtest (I had to use evtest instead keymap since mint 16 KDE use a newer version of systemd which merge the udev package on systemd). The generated scan codes displayed on evtest tool by this custom input device are:
  • FN+F2 = 13c
  • FN+F3 = 13d
  • FN+F4 = 13e
  • FN+F5 = 13f
  • FN+F11 = 157
  • FN+F12 = 158
I then used udevadm to print the device info to a file using this command:

Code: Select all

sudo udevadm info --export-db > Escritorio/udev-db.txt
The udev-db.txt file is too big to post it's content here but here are the relevant parts:

Code: Select all

:
:

P: /devices/virtual/input/input5
E: DEVPATH=/devices/virtual/input/input5
E: EV=13
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: KEY=40000 10000 1c00000000 0 0 1501f00002000 3809604001 2000000000000 0
E: MODALIAS=input:b0019v0000p0000e0000-e0,1,4,k71,80,8E,95,96,98,9B,A3,A4,A5,CD,E0,E1,E2,E3,E4,EC,EE,F0,1A2,1A3,1A4,1D0,212,ram4,lsfw
E: MSC=10
E: NAME="Toshiba input device"
E: PHYS="toshiba_acpi/input0"
E: PRODUCT=19/0/0/0
E: PROP=0
E: SUBSYSTEM=input
E: TAGS=:seat:
E: USEC_INITIALIZED=682543

:
:

P: /devices/virtual/dmi/id
E: DEVPATH=/devices/virtual/dmi/id
E: MODALIAS=dmi:bvnInsydeCorp.:bvr1.30:bd09/06/2013:svnTOSHIBA:pnSatelliteS75D-A:pvrPSKNSU-00G002:rvnAMD:rnPumori:rvrBaseBoardVersion:cvnOEMChassisManufacturer:ct10:cvrOEMChassisVersion:
E: SUBSYSTEM=dmi

:
:
.

The only strange thing to me about this file contents is that it identify this custom input device as input5 while evtest identify it as /dev/input/event6 but I suppose that is normal since one is the input itself and the other one is the event so let's assume that. Now that I have all that info the only remaining steps are to modify "/lib/udev/hwdb.d/60-keyboard.hwdb" file (once again, this file is for the merged udev with systemd version, the previous udev use other files) to add the custom input device keys behavior and finally use udevadm to update it:

Code: Select all

sudo udevadm hwdb --update
But I don't know how to identify this custom input device on 60-keyboard.hwdb file. I have made a lot of tries but none of then worked. Here are the code I added to that file:

Code: Select all

# Satellite S75D-A
keyboard:name:Toshiba input devide:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatelliteS75D-A:pvr*
 KEYBOARD_KEY_13c=brightnessdown
 KEYBOARD_KEY_13d=brightnessup
 KEYBOARD_KEY_13e=switchvideomode                        # switch display outputs
 KEYBOARD_KEY_13f=f21                                    # switch touchpad outputs
 KEYBOARD_KEY_158=wlan                                   # RF Switch Off
 KEYBOARD_KEY_157=mute                                   # audio mute/unmute
Does anyone knows how to correctly use this file and what I am missing? :(

Thanks

User avatar
roblm
Level 11
Level 11
Posts: 3520
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by roblm » Thu Dec 26, 2013 4:16 pm

EDITED 12-28-13: THIS METHOD DOES NOT WORK IN MINT 16 LIKE IT DID IN MINT 14 & 15.
If you enter the tty1 screen by pressing Ctrl+Alt+F1 and then type: /lib/udev/findkeyboards
is "Toshiba input device" listed? If it is then get it's input/event #. Then type:
sudo /lib/udev/keymap -i input/eventX
replacing X with the input/event #

Then see if any scandcodes are generated by pressing all the Fn+key combinations.
Press the Escape key. Take a screenshot with this command:
sudo screendump 1 > screenoutput.txt

Press Ctrl+Alt+F7 to exit the console. If this fails, then press Ctrl+Alt+F8.
The file "screenoutput.txt" will be found in your Home directory (/home/username).

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Thu Jan 02, 2014 2:09 pm

Hi roblm,

Just like you mention on your edit, that method doesn't work on mint 16 like did on mint 15 but I found what the diffence are. It basically is that /lib/udev/keymap was replaced by evtest (it doesn't come preinstalled) due to a merge between systemd and udev libraries, the results is systemd tools. Also, the file structure changed and the new file to contain the keyboard config is "/lib/udev/hwdb.d/60-keyboard.hwdb" along with other flies that contain the usb, acpi, etc configurations. Said that, here is the screendump:

Code: Select all

tato@TATO:~ > sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:      Power Button
/dev/input/event1:      Lid Switch
/dev/input/event2:      Power Button
/dev/input/event3:      AT Translated Set 2 keyboard
/dev/input/event4:      Video Bus
/dev/input/event5:      Toshiba input device
/dev/input/event6:      HDA ATI HDMI HDMI/DP,pcm=3
/dev/input/event7:      HD-Audio Generic Front Headphone
/dev/input/event8:      HD-Audio Generic Mic
/dev/input/event9:      TOSHIBA Web Camera - HD
/dev/input/event10:     ETPS/2 Elantech Touchpad
Select the device event number [0-10]: 5
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "Toshiba input device"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 128 (KEY_STOP)
    Event code 142 (KEY_SLEEP)
    Event code 149 (KEY_PROG2)
    Event code 150 (KEY_WWW)
    Event code 152 (KEY_SCREENLOCK)
    Event code 155 (KEY_MAIL)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 205 (KEY_SUSPEND)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 226 (KEY_MEDIA)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 228 (KEY_KBDILLUMTOGGLE)
    Event code 236 (KEY_BATTERY)
    Event code 238 (KEY_WLAN)
    Event code 240 (KEY_UNKNOWN)
    Event code 418 (KEY_ZOOMIN)
    Event code 419 (KEY_ZOOMOUT)
    Event code 420 (KEY_ZOOMRESET)
    Event code 464 (KEY_FN)
    Event code 530 (KEY_TOUCHPAD_TOGGLE)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Properties:
Testing ... (interrupt to exit)
^@Event: time 1388684282.335254, type 4 (EV_MSC), code 4 (MSC_SCAN), value 13c
Event: time 1388684282.335254, type 1 (EV_KEY), code 236 (KEY_BATTERY), value 1
Event: time 1388684282.335254, -------------- SYN_REPORT ------------
Event: time 1388684282.335269, type 1 (EV_KEY), code 236 (KEY_BATTERY), value 0
Event: time 1388684282.335269, -------------- SYN_REPORT ------------
^@Event: time 1388684288.035707, type 4 (EV_MSC), code 4 (MSC_SCAN), value 13d
Event: time 1388684288.035707, type 1 (EV_KEY), code 142 (KEY_SLEEP), value 1
Event: time 1388684288.035707, -------------- SYN_REPORT ------------
Event: time 1388684288.035729, type 1 (EV_KEY), code 142 (KEY_SLEEP), value 0
Event: time 1388684288.035729, -------------- SYN_REPORT ------------
^@Event: time 1388684290.284871, type 4 (EV_MSC), code 4 (MSC_SCAN), value 13e
Event: time 1388684290.284871, type 1 (EV_KEY), code 205 (KEY_SUSPEND), value 1
Event: time 1388684290.284871, -------------- SYN_REPORT ------------
Event: time 1388684290.284893, type 1 (EV_KEY), code 205 (KEY_SUSPEND), value 0
Event: time 1388684290.284893, -------------- SYN_REPORT ------------
^@Event: time 1388684292.674647, type 4 (EV_MSC), code 4 (MSC_SCAN), value 13f
Event: time 1388684292.674647, type 1 (EV_KEY), code 227 (KEY_SWITCHVIDEOMODE), value 1
Event: time 1388684292.674647, -------------- SYN_REPORT ------------
Event: time 1388684292.674669, type 1 (EV_KEY), code 227 (KEY_SWITCHVIDEOMODE), value 0
Event: time 1388684292.674669, -------------- SYN_REPORT ------------
^@Event: time 1388684299.082646, type 4 (EV_MSC), code 4 (MSC_SCAN), value 157
Event: time 1388684299.082646, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1388684299.082646, -------------- SYN_REPORT ------------
Event: time 1388684299.082669, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1388684299.082669, -------------- SYN_REPORT ------------
^@Event: time 1388684300.319398, type 4 (EV_MSC), code 4 (MSC_SCAN), value 158
Event: time 1388684300.319398, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1388684300.319398, -------------- SYN_REPORT ------------
Event: time 1388684300.319409, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1388684300.319409, -------------- SYN_REPORT ------------
tato@TATO:~ > sudo screendump 1 > screenoutput.txt
The scan code testing starts at "Testing ... (interrupt to exit)" line and I pressed the keys on the following order:
  • FN+F2
    FN+F3
    FN+F4
    FN+F5
    FN+F11
    FN+F12
Here is the 60-keyboard.hwdb file help:

Code: Select all

# This file is part of systemd.
#
# Keyboard mapping of scan codes to key codes, and
# scan codes to add to the AT keyboard's 'force-release' list.
#
# The lookup keys are composed in:
#   60-keyboard.rules
#
# Note: The format of the "keyboard:" prefix match key is a
# contract between the rules file and the hardware data, it might
# change in later revisions to support more or better matches, it
# is not necessarily expected to be a stable ABI.
#
# Supported hardware matches are:
#  - USB keyboards identified by the usb kernel modalias:
#      keyboard:usb:vXXXXpYYYY*
#    XXXX is the 4-digit hex uppercase vendor, and YYYY
#    the 4-digit hex uppercase product.
#
#  - AT keyboard DMI data matches:
#      keyboard:dmi:bvn*:bvr*:bd*:svn<vendor>:pn<product>:pvr*
#    <vendor> and <product> are the firmware-provided strings
#    exported by the kernel DMI modalias.
#
#  - Platform driver device name and DMI data match:
#      keyboard:name:<input device name>:dmi:bvn*:bvr*:bd*:svn<vendor>:pn*
#    <input device name> is the name device specified by the
#    driver, <vendor> is the firmware-provided string exported
#    by the kernel DMI modalias.
#
#  Scan codes are specified as:
#    KEYBOARD_KEY_<hex scan code>=<key code identifier>
#  The scan code should be expressed in hex lowercase and in
#  full bytes, a multiple of 2 digits. The key codes are retrieved
#  and normalized from the kernel input API header.
#
#  A '!' as the first charcter of the key identifier string
#  will add the scan code to the AT keyboard's list of scan codes
#  where the driver will synthesize a release event and not expect
#  it to be generated by the hardware.
#
# To debug key presses and access scan code mapping data of
# an input device use the commonly available tool: evtest(1).
And here is the "sudo udevadm info --export-db" relevant output:

Code: Select all

:

P: /devices/virtual/input/input5
E: DEVPATH=/devices/virtual/input/input5
E: EV=13
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: KEY=40000 10000 1c00000000 0 0 1501f00002000 3809604001 2000000000000 0
E: MODALIAS=input:b0019v0000p0000e0000-e0,1,4,k71,80,8E,95,96,98,9B,A3,A4,A5,CD,E0,E1,E2,E3,E4,EC,EE,F0,1A2,1A3,1A4,1D0,212,ram4,lsfw
E: MSC=10
E: NAME="Toshiba input device"
E: PHYS="toshiba_acpi/input0"
E: PRODUCT=19/0/0/0
E: PROP=0
E: SUBSYSTEM=input
E: TAGS=:seat:
E: USEC_INITIALIZED=682543

:
:

P: /devices/virtual/dmi/id
E: DEVPATH=/devices/virtual/dmi/id
E: MODALIAS=dmi:bvnInsydeCorp.:bvr1.30:bd09/06/2013:svnTOSHIBA:pnSatelliteS75D-A:pvrPSKNSU-00G002:rvnAMD:rnPumori:rvrBaseBoardVersion:cvnOEMChassisManufacturer:ct10:cvrOEMChassisVersion:
E: SUBSYSTEM=dmi

:
:
Thanks for your help, if you need something else, let me know and I will gladly provide it.

I will keep trying on the meanwhile :)

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Thu Jan 02, 2014 3:36 pm

Good news over here, I finally find my error on my "/lib/udev/hwdb.d/60-keyboard.hwdb" file! :D and it was that I wrote "Toshiba input devide" instead of "Toshiba input device" on 60-keyboard.hwdb file... >_> (I will do a simple copy and paste next time :/ )

So now F2, F3, F4, F5 multimedia keys are working and there are only 2 issues remaining:
  • F11 and F12 still not working for some reason I don't know
    And the dificult one, F2 and F3 multimedia keys does the brightness down and up as expected but it also execute the "switch display" functionality.
Here is what I add to my 60-keyboard.hwdb file:

Code: Select all

# Satellite S75D-A
keyboard:name:Toshiba input device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatelliteS75D-A:pvr*
 KEYBOARD_KEY_13c=brightnessdown                        # F2 - Less brightness
 KEYBOARD_KEY_13d=brightnessup                          # F3 - More brightness
 KEYBOARD_KEY_13e=switchvideomode                       # F4 - Switch display outputs
 KEYBOARD_KEY_13f=f21                                   # F5 - Touchpad on/off
 KEYBOARD_KEY_157=mute                                  # F11 - Audio mute/unmute
 KEYBOARD_KEY_158=wlan                                  # F12 - Wireless on/off
Just like I mention before, this will fix F4 and F5 multimedia keys completly, F2 and F3 works but it also execute the switch display functionality too, and F11 and F12 just didn't work.

I will keep working on this to fix it completly and I am sure that even when this didn't fix my multimedia keys issue at all, it will help others to fix their owns.

And by the way, Happy New Year to everyone!!! XD

User avatar
roblm
Level 11
Level 11
Posts: 3520
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by roblm » Sat Jan 04, 2014 3:17 pm

tato11,
I've been following your posts with interest because this information is needed for people with laptops that have
nonstandard special keys or multimedia keys that are not functioning, and where other methods don't work. Other
laptops such as Thinkpads, Sonys, and Acers can also have these keys on a separate input device instead of the
primary keyboard. For Sony the device is called “Sony Vaio Keys”.

You said in your second post and I quote: “The only strange thing to me about this file contents is that it identify this
custom input device as input5 while evtest identify it as /dev/input/event6”.
From my recent test I found that the input # reported by evtest is the same that is found in the “/var/log/Xorg.0.log” file
and in “/proc/bus/input/devices”.

You said that pressing Fn+F2 or Fn+F3 will control brightness now but “switchvideomode” is also activated, which is
supposed to change the video output. Does this cause your display to go black until you press one of those keys again,
or having to press more than once if your laptop has more than two video connectors?

You said that the Fn+F11 and Fn+F12 key combinations don't work. Do you need those functions? A workaround could
be to try the “setkeycodes” command to remap the scan code for “mute” to another keycode. This worked when I tried it
but I don't have a laptop so I don't know if it will work for your laptop's special keys. The scan code you got for “mute” was
157. Looking in the file “/user/include/linux/input.h”, which lists the keysymbols and the keycodes they are mapped to, the
keycode for “mute” is 113. So to map the scan code 157 to the new keycode 113, you could try the command:
sudo setkeycodes 157 113

I've found that the scan codes diplayed by using the Showkey utility are the same as the codes generated by evtest. To use
Showkey, go to the virtual console tty1 and type: showkey -s

Pressing F1 gives 0x3b, 0xbb
Pressing F2 gives 0x3c, 0xbc
The first code is for the key press and the second for the key release. The “0x” before each code is the so called “prefix”.
Using evtest and pressing F1 gives 3b and pressing F2 gives 3c.

On Mint 14 and 15, using “/lib/udev/keymap” to generate scan codes gave slightly different results than using Showkey.
Looking at the results from another topic I was involved in, using /lib/udev/keymap for F11 gave 0xAE. Using showkey for F11,
which shows a press and release event, gave: 0xeo 0x2e, 0xe0 0xae
The 0xe0 is the so called “prefix”. So the scan code 0xAE is similar to the press release code 0xae but one uses capital letters.

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Wed Jan 22, 2014 12:42 am

Hi roblm, sorry for my really late response but I was really busy with a few things.

You are right about the input device number, and I got different device numbers because it changes on every restart (I suppose that is why 60-keyboard.hwdb file uses the name instead of device number XD).

I got the "switch display/brightness" results by using xev and I haven't test using Fn+F2 and Fn+F3 while connect to another video output besides my laptop screen, but I will test it this week and let you know.

About Fn+F11 and Fn+F12, those match "mute/unmute" and "wireless on/off" functions and are displayed as unknown actions by both evtest and xev. When using evtest I got the codes 157 (for Fn+F11) and 158 (for Fn+F12) while "showkeys -s" don't even display a result (I suppose it doesn't even recognize it as keys).

Fn+F2 and Fn+F3 have a different behavior when comes to both evtest and showkey commands though. When using evtest I got 13c (for Fn+F2) and 13d (for Fn+F3) while showkey display this when I was on "ctrl+alt+F1" (the first line is Fn+F2 and the second line is Fn+F3):

Code: Select all

0xe0 0x4c 0xe0 0xcc
0xe0 0x54 0xe0 0xd4
but when I test showkey command using a terminal window on KDE, I got this:

Code: Select all

0xe0 0x4c 0xe0 0xcc 
0xe0 0x4c 0xe0 0xcc 0xe0 0x56 0xe0 0xd6 
0xe0 0x54 0xe0 0xd4 
0xe0 0x54 0xe0 0xd4 0xe0 0x56 0xe0 0xd6 
^@^@
Lines 1 and 2 are Fn+F2 pressing it 2 times, the first time xev shows as Brightness Down and second was Switch Display, Lines 3 and 4 are Fn+F3 pressing it 2 times, the first time xev shows as Brightness Up and second was Switch Display (this is the double function behavior I mention before for those keys). Finally, the "^@" characters happen when I pressed Fn+F11 and Fn+12 keys.

I can live without the Fn+F11 and Fn+F12 and I am doing that just now, but I really want to try to fix it so I will keep trying. If you need any other info then let me know and I will gladly provide it :)

Have a good night! XD

User avatar
roblm
Level 11
Level 11
Posts: 3520
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by roblm » Wed Jan 22, 2014 12:18 pm

tato11,

It's interesting that you got different scan codes with evtest and showkey when pressing key combinations such as Fn+F2
and Fn+F3, but I got the same codes when pressing single keys. However, it appears that the kernel can use the scan codes
from showkey from pressing key combinations, at least that's what happened in another recent topic I was involved with,
dealing with non working brightness special keys. In the link below, evtest did not generate any scan codes but showkey did
and they worked when they were added to a new section in the “60-keyboard.hwdb” file.
http://forums.linuxmint.com/viewtopic.php?f=49&t=155527

In another recent topic below very similar to yours, josefg did not experience the switchvideomode function being activated
when pressing Fn+F2 and Fn+F3 like you did.
http://forums.linuxmint.com/viewtopic.php?f=49&t=155225

It's also interesting to compare your line below:
keyboard:name:Toshiba input device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatelliteS75D-A:pvr*

with his:
keyboard:name:Toshiba input device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSATELLITE*C75-A:pvr*

josefg had to use all capital letters in the word SATELLITE for the brightness keys to work. Also, there is an asterisk after
SATELLITE. If you look at the examples in the “60-keyboard.hwdb” file, they don't all follow exact rules in syntax.

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Wed Jan 29, 2014 1:34 am

hi roblm,

I agree, it is really interesting that sometimes showkey works while evtest does on others. For example, I tried to use the showkey codes on my "60-keyboard.hwdb" file but didn't work so I keep the ones displayed by evtest, but on the posts you mention, showkey did work, so it is probably related with the kind of hardware. I tested both Fn+F2 and Fn+F3 using an external display and it actually did both actions changing the brightness and also switching the screen config, which makes me wonder if maybe the problem isn't on the systemd tools but maybe related to how X understand these extra input or maybe KDE. Although, I don't have anything to confirm that yet.

Now, about the “60-keyboard.hwdb” file line you mention:

Code: Select all

keyboard:name:Toshiba input device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatelliteS75D-A:pvr*
and

Code: Select all

keyboard:name:Toshiba input device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSATELLITE*C75-A:pvr*
These difference are because those commands are regular expressions and must match the keyboard description such like the device id or device name (as in this case), so while my laptop model is literally "SatelliteS75D-A" with those lower and upper letters, the laptop on the other post has literally its model name on upper case. Said that, the asterisk just before the "C75-A" means that it could have any chars there (like hyphens) or no char at all on the model name. I used the exact model and brand because I am kind of lazy XD, but the truth is that I should have used something like this:

Code: Select all

keyboard:name:[Tt][Oo][Ss][Hh][Ii][Bb][Aa] [Ii][Nn][Pp][Uu][Tt] [Dd][Ee][Vv][Ii][Cc][Ee]:dmi:bvn*:bvr*:bd*:svn[Tt][Oo][Ss][Hh][Ii][Bb][Aa]*:pn[Ss][Aa][Tt][Ee][Ll][Ll][Ii][Tt][Ee]*[Ss]75[Dd]-[Aa]:pvr*
I will keep my search to fix the remaining bugs but a little slower since I am a little busy with my jobs. Please keep me updated if you find anything else on the matter :)

mariogl91
Level 1
Level 1
Posts: 2
Joined: Sat Feb 01, 2014 8:22 am

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by mariogl91 » Sat Feb 01, 2014 8:31 am

Thank you! I'd been looking everywhere how to get the Fn Keys in my Toshiba S40Dt-A to work. Now all the keys work, except for mute and wifi. This is what I added to my 60-keyboard.hwdb:

Code: Select all

# Satellite S40Dt-A
keyboard:name:Toshiba input device:dmi:bvnTOSHIBA:bvr1.20:bd08/22/2013:svnTOSHIBA:pnSatelliteS40Dt-A:pvr*
 KEYBOARD_KEY_13c=brightnessdown
 KEYBOARD_KEY_13d=brightnessup
 KEYBOARD_KEY_13e=switchvideomode                        # switch display outputs
 KEYBOARD_KEY_13f=f21                                    # switch touchpad outputs
 KEYBOARD_KEY_158=wlan                                   # RF Switch Off
 KEYBOARD_KEY_157=mute                                   # audio mute/unmute
I confirm all the key codes match when using evtest.

I've attached a screenshot of what happens when trying to set the shortcut for mute.

Thanks again!
Attachments
mute.png

User avatar
roblm
Level 11
Level 11
Posts: 3520
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by roblm » Sat Feb 01, 2014 8:17 pm

mariogl91,

I noticed you didn't follow the standard formating for the second line as shown in the "60-keyboard.hwdb" file. So instead of:
keyboard:name:Toshiba input device:dmi:bvn*:bvr*:bd*:svnTOSHIBA*:pnSatelliteS40t-A:pvr*

You have:
keyboard:name:Toshiba input device:dmi:bvnTOSHIBA:bvr1.20:bd08/22/2013:svnTOSHIBA:pnSatelliteS40Dt-A:pvr*

Why did you decide on adding the additional information to the line? I'm not even sure what bvn, bvr and bd stand for. Where did
you get the information?

Could you try typing these commands in the Terminal to see if they can activate the mute and wlan functions. They will map the
scan codes from evtest to the standard keycodes that are listed in “/user/include/linux/input.h” for mute and wlan. I'm assuming you
got the same output as tato11 did when using evtest:
sudo setkeycodes 157 113
sudo setkeycodes 158 238

Any changes made will be gone when you restart your system.

mariogl91
Level 1
Level 1
Posts: 2
Joined: Sat Feb 01, 2014 8:22 am

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by mariogl91 » Sun Feb 02, 2014 6:21 pm

roblm,

This is kind of embarassing... I didn't decide to add it, I just don't know what it means. I saw it when I ran:

Code: Select all

sudo udevadm info -- export/db > Desktop/udev-db.txt
This is the part I'm telling you about:

Code: Select all

P: /devices/virtual/dmi/id
E: DEVPATH=/devices/virtual/dmi/id
E: MODALIAS=dmi:bvnTOSHIBA:bvr1.20:bd08/22/2013:svnTOSHIBA:pnSatelliteS40Dt-A:pvrPSKJAM-004TM1:rvnTOSHIBA:rnVDKTE:rvr1.00:cvnTOSHIBA:ct10:cvr*:
E: SUBSYSTEM=dmi

P: /devices/virtual/graphics/fbcon
E: DEVPATH=/devices/virtual/graphics/fbcon
E: SUBSYSTEM=graphics

P: /devices/virtual/input/input5
E: DEVPATH=/devices/virtual/input/input5
E: EV=13
E: ID_INPUT=1
E: ID_INPUT_KEY=1
E: KEY=40000 10000 1c00000000 0 0 1401f00000000 8000003809600001 2000000000000 0
E: MODALIAS=input:b0019v0000p0000e0000-e0,1,4,k71,80,95,96,98,9B,A3,A4,A5,BF,E0,E1,E2,E3,E4,EE,F0,1A2,1A3,1A4,1D0,212,ram4,lsfw
E: MSC=10
E: NAME="Toshiba input device"
E: PHYS="toshiba_acpi/input0"
E: PRODUCT=19/0/0/0
E: PROP=0
E: SUBSYSTEM=input
E: TAGS=:seat:
E: USEC_INITIALIZED=946643
Should I change it to the standard formatting?

Regarding the commands you mentioned, I ran them, but the keys still don't work. This is the output of evtest when pressing the corresponding keys for mute and wlan:

Code: Select all

Event: time 1391379457.415399, type 4 (EV_MSC), code 4 (MSC_SCAN), value 157
Event: time 1391379457.415399, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1391379457.415399, -------------- SYN_REPORT ------------
Event: time 1391379457.415445, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1391379457.415445, -------------- SYN_REPORT ------------
Event: time 1391379459.467724, type 4 (EV_MSC), code 4 (MSC_SCAN), value 158
Event: time 1391379459.467724, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 1
Event: time 1391379459.467724, -------------- SYN_REPORT ------------
Event: time 1391379459.467766, type 1 (EV_KEY), code 240 (KEY_UNKNOWN), value 0
Event: time 1391379459.467766, -------------- SYN_REPORT ------------
Thanks!
Mario

User avatar
roblm
Level 11
Level 11
Posts: 3520
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by roblm » Sun Feb 02, 2014 10:29 pm

Mario,

Looking over where you got the information for your second line, I think it's fine to leave it like it is. You just used an
expanded version of that line instead of a condensed version. Tato11 didn't add all that extra info to his line and I didn't
include it either in the other similar topics I've been involved with. But I'm glad you did it that way because I learned
something new myself.

One advantage of using the info from running the command “sudo udevadm info --export/db” is that the vendor name and
model name will be displayed correctly. Otherwise you have to determine whether the words are in capital or small letters.
For example, in a recent topic I was involved with, the word “Satellite” had to be in all capital letters to work. This can be
determined by typing the commands:

cat /sys/class/dmi/id/sys_vendor
cat /sys/class/dmi/id/product_name

and looking at the results to see if the words are capitalized or not.

I suppose bvn, bvr and bd stand for something like “build vendor name”, “build version release” and “build date”.

It looks like the special keys for mute and wlan won't be usable. Your result from running evtest is the same as tato11 got
for those keys, which is “(KEY_UNKNOWN)”, but you probably don't need those keys to work. The only other method to try
that I know of is to use the showkey utility to generate scan codes and keycodes. I know this can get kind of tedious but if
you want to try that method then do these steps.

Press Ctrl+Alt+F1 to enter the tty1 virtual console and then type this command to get scan codes and press Enter: showkey -s
Press Fn+F2 and Fn+F3. Wait 10 seconds for the program to end. EDITED: should be Fn+F11 and Fn+F12

Then type this command to get key codes: showkey -k
Press Fn+F2 and Fn+F3 again. Wait for the program to end. EDITED: should be Fn+F11 and Fn+F12

Then type this command to get a screenshot: sudo screendump 1 > screenoutput.txt
The file “screenshot.txt” will be found in your /home/user-name directory.

The special keys for wireless can sometimes report different scan codes depending on whether you have enabled the device
or not, so turn it off and then repeat the steps above for Fn+F12.

If you get no scan codes generated then it's still possible that some information about them was put in the “/var/log/dmesg” file.
Look for a line similar to this:
Unknown key pressed (translated set 2, code 0xa0 on isa0060/serio0)

Look in the end section of the file.
Last edited by roblm on Fri Feb 07, 2014 4:09 pm, edited 2 times in total.

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Mon Feb 03, 2014 1:35 am

Hi everyone,

First of all, let me say that I am really happy that all my research is helping a lot of people, just like helped you Mario! :D

Now, let me help with some other details like the second line roblm mention :). The "MODALIAS" value is kind of the identifier of your laptop model with all kind of details like the vendor name, exact model name, build date, etc. (that is why it has all these details like "svnTOSHIBA:pnSatelliteS40Dt-A"). "60-keyboard.hwdb" file use a regular expression to identify what rules should apply to the hardward inputs which are the keyboard keys on this case. A regular expression is kind of a mask used to search which has some special characters used as wildcards, for example, if we put an asterisk then it will match any character until it find the next character on the mask which means that if we had a regular expresion like "bvr*:svnTOSHIBA", then it will apply the keyboard keys rules to any text that match the mask like "bvr1.20:bd08/22/2013:svnTOSHIBA", "bvrANYTHING:svnTOSHIBA" or even "bvr:svnTOSHIBA" since asterisk wildcard also means no character but it wouldn't match a text like "bvrANYTHING" because it is missing the last part of the mask: "svnTOSHIBA" (I hope I didn't screw up at explaining this XD). This is why using that extra information Mario used work as well as the short version I and roblm used would :p

roblm, about the test you asked to mario, I think you mean "Fn+F11 and Fn+F12" instead of "Fn+F2 and Fn+F3" (just asking :p), and I am really curious about this test results as well. I hope its results let us a little closer to fix the last issues XD

Regards,

seanharris1991
Level 1
Level 1
Posts: 6
Joined: Sat Mar 01, 2014 9:06 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by seanharris1991 » Sat Mar 01, 2014 9:12 pm

Hi,

thanks for all of the infomation above as i have got all my function keys working now apart from mute (FN + F11) WIFI on/off (FN + F12).

Has there been any advancment with making the mute and wifi keys to work ?

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Sat Mar 01, 2014 10:56 pm

Hi seanharris1991,

I have been really busy with work and some other not software related projects (I like art :p), so no update from my side today but I am planning to continue with it once the storm is calm. Although, maybe roblm has an update, he is more active than me on the forums :)

If you really need those functionalities, then I recommend you to set a global shortcut to control the mute and wifi on the meanwhile XD

seanharris1991
Level 1
Level 1
Posts: 6
Joined: Sat Mar 01, 2014 9:06 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by seanharris1991 » Sun Mar 23, 2014 4:31 pm

Hi,

i was installing elementory os luna and i found that the mute key (fn + F11) was working on my laptop, the kernel i was running was 3.2. i duuno if this will help in solving this issue or not.

Regards

User avatar
roblm
Level 11
Level 11
Posts: 3520
Joined: Sun Feb 24, 2013 2:41 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by roblm » Sat Mar 29, 2014 1:18 pm

tato11,

Did you look at dollyp's last post in this topic:
http://forums.linuxmint.com/viewtopic.php?f=49&t=155527

In his “60-keyboard.hwdb” file, the line:
KEYBOARD_KEY_be=touchpad_toggle

was changed to:
KEYBOARD_KEY_be=!touchpad_toggle

By adding an apostrophe in front of the key identifier (keysym) “touchpad_toggle”, it enabled that function to work. According to
the comments in the “60-keyboard.hwdb” file, adding an apostrophe will add the scan code to the AT keyboard's 'force-release'
list. Whenever a key is pressed, there is supposed to be a key press event generated and a key release event, but sometimes
this doesn't work correctly at the hardware level. I noticed that some of the mappings in the Samsung section use this format.

Also, sometimes no key identifier is used. I noticed this line in the GIGABYTE section:

Code: Select all

 KEYBOARD_KEY_a0=!          # mute 
And this line in the Samsung section:

Code: Select all

 KEYBOARD_KEY_97=!          # Fn+F12  Wi-Fi toggle
You could try changing the lines in your “60-keyboard.hwdb” file from:

Code: Select all

 KEYBOARD_KEY_157=mute               # F11 - Audio mute/unmute
 KEYBOARD_KEY_158=wlan               # F12 - Wireless on/off
to:

Code: Select all

 KEYBOARD_KEY_157=!mute              # F11 - Audio mute/unmute
 KEYBOARD_KEY_158=!wlan              # F12 - Wireless on/off
or if that doesn't work, try:

Code: Select all

 KEYBOARD_KEY_157=!                  # F11 - Audio mute/unmute
 KEYBOARD_KEY_158=!                  # F12 - Wireless on/off
EDITED 3-30-14:
If the method above doesn't work, then custom keyboard shortcuts can be made for wireless on/off. This isn't needed for audio
mute/unmute because the volume icon in the system tray can be right clicked to do this. However, if someone needs an alternate
method of doing this, then I can post the instructions.
Go to System Settings → Keyboard. Click the "Keyboard shortcuts" tab. On the left click "Custom Shortcut". Click "Add custom
shortcut". In the new window next to "name" type: wifi-off
In the "command" line type: rfkill block wifi

Click "Add". The new custom keyboard name should be hightlighted. Click on "unassigned" until it changes to "New accelerator..."
Press the key combinations you want to use. I used Ctrl+Down Arrow, but you can use whatever you want.

Then make another custom keyboard shorcut named: wifi-on
In the command line type: rfkill unblock wifi
For the key combinations I used Ctrl+Up Arrow

tato11
Level 1
Level 1
Posts: 15
Joined: Mon Dec 16, 2013 12:38 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by tato11 » Thu Apr 17, 2014 7:55 pm

hi roblm,

Sorry for my really late response once again. I have checked dollyp's post and also tested the use of "!" on the "60-keyboard.hwdb" file but it didn't work :(, I even tried:

Code: Select all

KEYBOARD_KEY_157=                   # F11 - Audio mute/unmute
KEYBOARD_KEY_158=                   # F12 - Wireless on/off
just in case, but didn work either.

I have been thinking about this issue in a different way the last days and come up with some ideas I would like to share like: What if the problem is not related to systemd itself but to the way these extra device keys are recognized by X configuration?, it could be understanding the 157 and 158 key codes as if were key combinations like "Ctrl + Up" or "Alt + Q", which would explain why I got "^@" everytime I try "showkey -s" as well as explain why when "Ctrl + Alt + F1" (terminal mode) these keys are recognized correctly while on X session are "Unknown". If this is correct, then we should be able to fix it or at least file a bug about key codes wrongly being recognized as key combinations.

I will try to explore this a little bit more on the following days and let you all know if I found anything.

seanharris1991, can you check if the "60-keyboard.hwdb" file exists on your luna OS (it should exists if it's the same systemd version we are dealing with :p)? If it does exists, then, can you post the file and share it with us? :)

Thanks! XD

seanharris1991
Level 1
Level 1
Posts: 6
Joined: Sat Mar 01, 2014 9:06 pm

Re: Trying to fix multimedia keys on Toshiba Satellite S75D

Post by seanharris1991 » Sat Apr 19, 2014 8:36 pm

tato11,

i have kubuntu 14.04 installation on my toshiba satellite pro laptop at the moment which is running kernel version 3.14. i downgraded my kernel to 3.2 as said in my comment above and the mute key is now working so i believe this is a kernel issue rather than a systemd issue. if there is anything more i can do to help please let me know.

Post Reply

Return to “Hardware Support”