0

I am using keyfuzz to map Alt-Eject to Alt-SysRq in Mac keyboard (See here). But on recent (X)ubuntus it is preferred to use systemd service to run the needed command at startup. I wonder how early I can put that service to be executed? Like which WantedBy=, After=, Before= and such attributes to use so that the configuration works and will not be overwritten? Will it work even in rescue mode boot then?

here is some reference about dependencies between different targets.

Edit: I put WantedBy=multi-user.target friendly-recovery.target in [Install] section of the .service file I created. That seems to work also in recovery mode root shell.

jarno
  • 6,175

2 Answers2

0

I put WantedBy=multi-user.target friendly-recovery.target in [Install] section of the .service file I created. That seems to work also in recovery mode root shell. Still, I don't know, if this is the best configuration to use.

jarno
  • 6,175
0

Instead of using keyfuzz I tried to remap scancode->keycode like danzel advised in a command, and according to instructions in /lib/udev/hwdb.d/60-keyboard.hwdb and in here.

I created file /etc/udev/hwdb.d/10-apple-keyboard.hwdb with the following contents:

evdev:name:Apple, Inc. Apple Internal Keyboard / Trackpad:dmi:bvn*:bvr*:bd*:svnAppleInc.:pn*
 KEYBOARD_KEY_c00b8=sysrq

For the file I got the device name from the third line of the output of sudo evtest /dev/input/by-id/usb-Apple__Inc._Apple_Internal_Keyboard___Trackpad-evenkbd, the scancode of the eject key by the same command - see related answer - and keycode from /usr/include/linux/input-event-codes.h (in lowercase and without 'key_' prefix in above.)

But still pressing the eject button triggers KEY_EJECTCD and not KEY_SYSRQ as shown by sudo uvtest:

Event: time 1567436214.147340, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b8
Event: time 1567436214.147340, type 1 (EV_KEY), code 161 (KEY_EJECTCD), value 1
Event: time 1567436214.147340, -------------- SYN_REPORT ------------

I can not confirm the key mapping:

udevadm info /dev/input/by-id/usb-Apple__Inc._Apple_Internal_Keyboard___Trackpad-event-kbd | grep KEYBOARD_KEY

That does not display anything.

jarno
  • 6,175