On 19 December 2014 at 01:29, Patrick O'Callaghan <pocallaghan(a)gmail.com>
wrote:
On Thu, 2014-12-18 at 12:27 -0700, jd1008 wrote:
> On 12/18/2014 12:12 PM, Beartooth wrote:
> > On Thu, 18 Dec 2014 16:31:49 +0000, Patrick O'Callaghan wrote:
> > [....]
> >> I'm sure I would still hit it occasionally. The problem is that I often
> >> don't notice until I've overwritten a bunch of characters, so I
prefer
> >> to put it beyond use.
> >>
> >>
> >>
> To the original OP:
> This is what I do in order to disable a key:
> sudo /bin/loadkeys << 'EOF'
> keycode TheKeyCodeInQuestion = NoSymbol
> EOF
>
> If you do not know the KeyCode, run the program:
> showkey
>
> and press the key in question
> and it's code will be displayed.
> You must wait 10 seconds of idle
> and showkey program will exit;
> then run the sudo script above.
>
I already did the equivalent of all that using xmodmap and xev. See
earlier posts. Furthermore, the request was for a way to do it for all
input from the keyboard, not just a specific terminal session.
Thanks all the same.
poc
You can do that using the udev hwdb by remapping the key scan codes.
- Use evtest as root to find out which input device the keyboard is.
- Using evtest, find out the hex scan code of the "insert" key, for
example on my system:
Event: time 1418977628.734851, -------------- SYN_REPORT ------------
Event: time 1418977631.694868, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70049
Event: time 1418977631.694868, type 1 (EV_KEY), code 110 (KEY_INSERT), value 1
Event: time 1418977631.694868, -------------- SYN_REPORT ------------
Event: time 1418977631.774858, type 4 (EV_MSC), code 4 (MSC_SCAN), value 70049
Event: time 1418977631.774858, type 1 (EV_KEY), code 110 (KEY_INSERT), value 0
Event: time 1418977631.774858, -------------- SYN_REPORT ------------
in this case the hex scan code is 70049 .
- Use udevadm to get the vendor ID and the model ID for that keyboard:
udevadm info /dev/input/eventXX
where XX is the value you used/get from evtest above, note down the
ID_VENDOR_ID and the ID_MODEL_ID values for that keyboard
- Create /etc/udev/hwdb.d/70-keyboard.hwdb and put this in it:
keyboard:usb:v<ID_VENDOR_ID>p<ID_MODEL_ID>*
KEYBOARD_KEY_<hex scan code>=backspace
replace <ID_VENDOR_ID> with the actual value of ID_VENDOR_ID... etc.
Note that the file is syntax sensitive so you need a space at the
beginning of the KEYBOARD_KEY_ line
- As root:
udevadm hwdb --update
finally unplug/re-plug the keyboard.
Have a look at /usr/lib/udev/hwdb.d/60-keyboard.hwdb for more info.
--
Ahmad Samir