Mapping the special function keys on a Penguin T4 Laptop

The primary special function keys will already work, but if you're interested in mapping the touchpad special function key to toggle the touchpad on and off here is how you do it. If you have any questions about this documentation or need further assitance contact support.

1. Open a terminal and run:

sudo nano /etc/udev/hwdb.d/61-keyboard-local.hwdb

2. Copy and paste the below lines, then hold down the ctrl key and while doing so tap the x key. You will be prompted to save the file. Hit the y key to save it:

evdev:atkbd:dmi:bvn*:bvr*:bd*:svnNotebook*:pn*
 KEYBOARD_KEY_f7=f21
 KEYBOARD_KEY_f8=f21

3. Now run the following three commands to apply these changes:

sudo udevadm hwdb --update
sudo udevadm trigger
sudo reboot

When the system reboots you'll have a functioning special function key to toggle the touchpad on and off.






The technical details for anyone who is interested in mapping a special function key more generally

1. First you need to open a terminal and install evtest:

sudo apt install evtest

2.You then need to run evtest and select the event # for your keyboard. In the case of our T4 laptop you would enter 3.

sudo evtest

Example output:

No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0: Power Button
/dev/input/event1: Sleep Button
/dev/input/event2: Lid Switch
/dev/input/event3: AT Translated Set 2 keyboard
/dev/input/event4: Chicony USB2.0 Camera: Chicony
/dev/input/event5: ELAN0412:01 04F3:3162 Mouse
/dev/input/event6: C-Media Electronics Inc. USB Advanced Audio Device
/dev/input/event7: ETPS/2 Elantech Touchpad
/dev/input/event8: Video Bus
/dev/input/event9: Intel HID events
/dev/input/event10: ELAN0412:01 04F3:3162 Touchpad
/dev/input/event11: HDA Intel PCH HDMI/DP,pcm=3
/dev/input/event12: HDA Intel PCH HDMI/DP,pcm=7
/dev/input/event13: HDA Intel PCH HDMI/DP,pcm=8
/dev/input/event14: HDA Intel PCH HDMI/DP,pcm=9
Select the device event number [0-14]: 3

3. Press and hold the Fn key on the keyboard. While holding down this key tap the special function key. In our example this is the F1 key or the key to toggle the touchpad on and off at least while the Fn key is being held down. We need to get the Scancode value.

In our example the output looks like this and the MSC_SCAN code values we're concerned about are value f8 and f7.

Note: I had to tap the F1 / touchpad key a few times to get both these values the key generates.

Event: time 1697748425.297673, type 4 (EV_MSC), code 4 (MSC_SCAN), value f8
Event: time 1697748425.297673, type 1 (EV_KEY), code 191 (KEY_F21), value 0
Event: time 1697748425.297673, -------------- SYN_REPORT ------------
Event: time 1697748431.356136, type 4 (EV_MSC), code 4 (MSC_SCAN), value f7
Event: time 1697748431.356136, type 1 (EV_KEY), code 191 (KEY_F21), value 1

4. For AT keyboards run the following command:

cat /sys/class/dmi/id/modalias

Example output on the T4 is:

dmi:bvnINSYDECorp.:bvr1.07.03TP:bd05/04/2023:br7.3:efr7.2:svnNotebook:pnNJx0AU:pvrNotApplicable:rvnNotebook:rnNJx0AU:rvrNotApplicable:cvnNoEnclosure:ct10:cvrN/A:skuNotApplicable:

5. Note the section that starts with svn in the above example :svnNotebook: ... this identifies your notebook input device. If you have a different notebook you'd replace the part that reads svnNotebook below. Following this line put a single period followed by the Scancode we got in step 3. In out case we got two Scancodes so we're doing two lines like below.

evdev:atkbd:dmi:bvn*:bvr*:bd*:svnNotebook*:pn*
 KEYBOARD_KEY_f7=f11
 KEYBOARD_KEY_f8=f11

Note: This remaps the touchpad special function key to send F11 codes which means if we press the touchpad special function key while holding down the Fn key you should find that the window goes full screen as that is what F11 normally does.

F21 on our T4 will enable/disable the touchpad. So we're actually going to change the f11 to f21 in our example below:

evdev:atkbd:dmi:bvn*:bvr*:bd*:svnNotebook*:pn*
 KEYBOARD_KEY_f7=f21
 KEYBOARD_KEY_f8=f21

6. Run nano and copy the above into a hwdb file like so, then Ctrl+X and hit the Y key to save:

sudo nano /etc/udev/hwdb.d/61-keyboard-local.hwdb

7. Now run the following three commands to apply these changes:

sudo udevadm hwdb --update
sudo udevadm trigger
sudo reboot