Showing posts with label multimedia keys. Show all posts
Showing posts with label multimedia keys. Show all posts

Tuesday, 4 February 2020

Ubuntu Linux on Lenovo Yoga S940

I installed Ubuntu Linux (19.10) on my new laptop Lenovo Yoga S940 at first it seemed everything worked but then I realised there were some serious issues, see the summary below:
1) touchpad: did not work after reboot (fix)
2) sleep: laptop would randomly wake up from sleep (fix)
3) multimedia  keys: volume control buttons would get stuck and drive sound volume to 0% or 100%, other multimedia keys work properly. (fix)
4) built-in microphone: did not work (still does not work). But the external microphone works. Built in microphone requires Sound Open Firmware. (fix)
5) WiFi: works out of the box
6) graphics: works OOTB
7) HiDPI scaling: works out of the box
8) sound: 4 speakers work out of the box, but subwoofer does not work. I fixed it by switching to Sound Open Firmware.
9) Battery life is not very good, it is about 4 to 5 hours. Partially it is because of 4k display. However the  main battery consumer in my case is the web browser. Currently web browsers on Linux do not support GPU acceleration which leads to very high processor load.
10) Battery  conservation mode: works.

NB: Author of the blog is not responsible for  any damage experiments may cause. You perform manipulations on your own risk.

Ubuntu Linux on Lenovo Yoga S940: volume control key press repeats until volume goes to maximum or minimum

I encountered a strange  problem with functional keys for volume control on my Lenovo Yoga S940 under Ubuntu Linux 19.10. Whenever I would increase or  decrease the sound volume if I hold the key pressed long enough for the OS to register the  repeat  it would repeat the key press even after I have  released the button until the volume goes to 100% or 0% correspondingly to the key which was  pressed. Be careful with experimenting, 100% volume can damage your hearing! Author of the blog is not responsible for  any damage experiments may cause.

The issue was present in both modes of functional keys i.e. when the multimedia control is primary and F1-F12 are accessible through Fn key or opposite. One can change it in BIOS. I personally prefer when F1-F10 is set as primary and multimedia keys require Fn. Interestingly only volume control keys were affected, screen brightness control worked as expected.

Search on the internet lead me to this post on Stack Overflow. After reading the post I tried to press any other key while volume was going up and down and the additional keypress stopped the process which  reassured me that I had the same problem.

I followed  the advice posted  on Stack Overflow. Obviously I had another  model of the laptop and I had to edit the hardware  info.

The command "cat /sys/class/dmi/id/modalias" gave me the information about my hardware. I created a file /lib/udev/hwdb.d/99-keyboard-lenovo-vol-fix.hwdb
and inserted following lines:
"# Fix for volume keys on Lenovo Yoga S940
evdev:atkbd:dmi:bvn*:bvr*:svnLENOVO:pn81Q7*:pvrLenovoYogaS940*
 KEYBOARD_KEY_a0=!mute
 KEYBOARD_KEY_ae=!volumedown
 KEYBOARD_KEY_b0=!volumeup"

 The next step was to run these two commands as root:
systemd-hwdb update
udevadm trigger --verbose --sysname-match="event*"


Now volume control buttons work as expected.

The model identifier  of the laptop with 8th gen CPU was pn81Q7, for 10th gen it seems to be pn81Q8. One can try to use pn*