How to assign value to key
Matthew Barrera
A few months ago I tried to reassign some keys on my keyboard and accidentally broke my '8' key. Unfortunately, I have no idea how I did it because I tried out a few different methods and didn't notice that I had broken it until a few days later.
To fix it, I used xev to find out the keycode, 17, then I used xmodmap to assign the correct value: xmodmap -e "keycode 17=8".
However, the key still doesn't work. When I check it out in xev it shows the right keycode and the right assigned value but the computer doesn't seem to be recognising when the key is pressed. I know the key works because if I hold it down it starts printing 8s after a few seconds.
Update: I just noticed that after messing around with xmodmaps the shift+8 and alt+8 functionality is now also broken so I cannot get a left parenthesis or the left square bracket.
Resetting the keyboard to the default should work. I tried doing it with dpkg-reconfigure keyboard-configuration but I am using a lenovo t460p and they don't seem to have correct keyboard model.
I have been looking around the forums but I can't seem to find a solution. The all seem to be for adding shortcuts or switching key values. Any help would be much appreciated.
71 Answer
It turns out the shortcut I had previously been trying to add via System Settings/Keyboard/Shortcuts/Custom Shortcuts was still there and was the cause of the problem.
I had been trying to assign the period "." to the "," key on the German numeric keypad on my keyboard. I added the shortcut via the GUI and I'm not sure how it got mixed up. The '8' key did not seem to be assigned to it.
When I tried xmodmap -pke | grep 8, the key seemed to be assigned correctly. Also, resetting the keyboard with setxkbmap -layout de had no effect.
However, when I deleted the shortcut the 8 key went back to behaving normally.