Spontaneous numlock
#41
If you have systemsettings5..........
input devices ->keyboard -> hardware tab -> keyboard model
For me,, Generic | Generic 86-key PC
layout tab
us English (US) us
  Reply
#42
Probably everybody has localectl since it's command line, My Debian and Manjaro both have it without installing anything special.  In Debian I see:
Code:
System Locale: LANG=C.UTF-8
      VC Keymap: n/a
      X11 Layout: us
      X11 Model: pc105
I was just booted into Manjaro and I was seeing a UK keyboard layout.  " displayed as @ was the first thing I noticed about it.

Try apropos keyboard.  or setxkbmap -query  Linux has been dealing with keymaps since there was Linux.  And some documentation is outdated too.
  Reply
#43
I think we want to look at scancodes to start, not the keycodes they're mapped to.  A scancode involves a row and column on the physical keyboard.  https://en.wikipedia.org/wiki/Keyboard_layout

AKA keysyms

showkey -s will give scancodes.  dumpkeys, loadkeys, keymaps, xmodmap are all involved.

showkey -s tells me that Esc has a scancode of 0x01 which I believe because of the rows and columns thing.  But like most Linux documentation it may be 20 years old and wrong.  Yup, the showkey man page is dated 1 Feb 1998.  Some things and be old and still correct.  Somewhere else it mentions some scenario where when you ask for scancodes they're generated from keycodes by applying an inverse mapping.
  Reply
#44
I suspect the keyboard doesn't send scan codes over USB. I could be wrong. But what I'm thinking is that if it did, you'd get one for Fn and the like.
  Reply
#45
Yes, the modifier keys like shifts have their own scancodes.  I got this with dumpkeys -f while on my PBP in Debian.  But I'm not sure it's not just dumping some theoretical table in ROM instead of reading through the USB.  The full 127 maps went over the 65k limit for a post so I only kept 3.

Looks the same when I do it on a Raspberrry Pi with a 101-key USB keyboard.
Code:
keymaps 0-127 (only 3 here)
keycode   1 = Escape           Escape           Escape
keycode   2 = one              exclam           one
keycode   3 = two              at               two
keycode   4 = three            numbersign       three
keycode   5 = four             dollar           four
keycode   6 = five             percent          five
keycode   7 = six              asciicircum      six
keycode   8 = seven            ampersand        seven
keycode   9 = eight            asterisk         eight
keycode  10 = nine             parenleft        nine
keycode  11 = zero             parenright       zero
keycode  12 = minus            underscore       minus
keycode  13 = equal            plus             equal
keycode  14 = Delete           Delete           Delete
keycode  15 = Tab              Meta_Tab         Tab
keycode  16 = +q               +Q               +q
keycode  17 = +w               +W               +w
keycode  18 = +e               +E               +e
keycode  19 = +r               +R               +r
keycode  20 = +t               +T               +t
keycode  21 = +y               +Y               +y
keycode  22 = +u               +U               +u
keycode  23 = +i               +I               +i
keycode  24 = +o               +O               +o
keycode  25 = +p               +P               +p
keycode  26 = bracketleft      braceleft        bracketleft
keycode  27 = bracketright     braceright       bracketright
keycode  28 = Return           Return           Return
keycode  29 = Control          Control          Control
keycode  30 = +a               +A               +a
keycode  31 = +s               +S               +s
keycode  32 = +d               +D               +d
keycode  33 = +f               +F               +f
keycode  34 = +g               +G               +g
keycode  35 = +h               +H               +h
keycode  36 = +j               +J               +j
keycode  37 = +k               +K               +k
keycode  38 = +l               +L               +l
keycode  39 = semicolon        colon            semicolon
keycode  40 = apostrophe       quotedbl         apostrophe
keycode  41 = grave            asciitilde       grave
keycode  42 = Shift            Shift            Shift
keycode  43 = backslash        bar              backslash
keycode  44 = +z               +Z               +z
keycode  45 = +x               +X               +x
keycode  46 = +c               +C               +c
keycode  47 = +v               +V               +v
keycode  48 = +b               +B               +b
keycode  49 = +n               +N               +n
keycode  50 = +m               +M               +m
keycode  51 = comma            less             comma
keycode  52 = period           greater          period
keycode  53 = slash            question         slash
keycode  54 = Shift            Shift            Shift
keycode  55 = KP_Multiply      KP_Multiply      Hex_C
keycode  56 = Alt              Alt              Alt
keycode  57 = space            space            space
keycode  58 = Caps_Lock        Caps_Lock        Caps_Lock
keycode  59 = F1               F13              Console_13
keycode  60 = F2               F14              Console_14
keycode  61 = F3               F15              Console_15
keycode  62 = F4               F16              Console_16
keycode  63 = F5               F17              Console_17
keycode  64 = F6               F18              Console_18
keycode  65 = F7               F19              Console_19
keycode  66 = F8               F20              Console_20
keycode  67 = F9               F21              Console_21
keycode  68 = F10              F22              Console_22
keycode  69 = Num_Lock         Num_Lock         Hex_A
keycode  70 = Scroll_Lock      Show_Memory      Show_Registers
keycode  71 = KP_7             KP_7             Hex_7
keycode  72 = KP_8             KP_8             Hex_8
keycode  73 = KP_9             KP_9             Hex_9
keycode  74 = KP_Subtract      KP_Subtract      Hex_D
keycode  75 = KP_4             KP_4             Hex_4
keycode  76 = KP_5             KP_5             Hex_5
keycode  77 = KP_6             KP_6             Hex_6
keycode  78 = KP_Add           KP_Add           Hex_E
keycode  79 = KP_1             KP_1             Hex_1
keycode  80 = KP_2             KP_2             Hex_2
keycode  81 = KP_3             KP_3             Hex_3
keycode  82 = KP_0             KP_0             Hex_0
keycode  83 = KP_Period        KP_Period        KP_Period
keycode  84 = Last_Console     Last_Console     Last_Console
keycode  85 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  86 = less             greater          bar
keycode  87 = F11              F23              Console_23
keycode  88 = F12              F24              Console_24
keycode  89 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  90 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  91 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  92 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  93 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  94 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  95 = VoidSymbol       VoidSymbol       VoidSymbol
keycode  96 = KP_Enter         KP_Enter         Hex_F
keycode  97 = Control          Control          Control
keycode  98 = KP_Divide        KP_Divide        Hex_B
keycode  99 = VoidSymbol       VoidSymbol       Control_backslas
keycode 100 = Alt              Alt              Alt
keycode 101 = Break            Break            Break
keycode 102 = Find             Find             Find
keycode 103 = Up               Up               Up
keycode 104 = Prior            Scroll_Backward  Prior
keycode 105 = Left             Left             Left
keycode 106 = Right            Right            Right
keycode 107 = Select           Select           Select
keycode 108 = Down             Down             Down
keycode 109 = Next             Scroll_Forward   Next
keycode 110 = Insert           Insert           Insert
keycode 111 = Remove           Remove           Remove
keycode 112 = Macro            Macro            Macro
keycode 113 = F13              F13              F13
keycode 114 = F14              F14              F14
keycode 115 = Help             Help             Help
keycode 116 = Do               Do               Do
keycode 117 = F17              F17              F17
keycode 118 = KP_MinPlus       KP_MinPlus       KP_MinPlus
keycode 119 = Pause            Pause            Pause
keycode 120 = VoidSymbol       VoidSymbol       VoidSymbol
keycode 121 = KP_Period        KP_Period        KP_Period
keycode 122 = VoidSymbol       VoidSymbol       VoidSymbol
keycode 123 = VoidSymbol       VoidSymbol       VoidSymbol
keycode 124 = VoidSymbol       VoidSymbol       VoidSymbol
keycode 125 = Alt              Alt              Alt
keycode 126 = Alt              Alt              Alt


Seems like I've seen, for some keyboards, the scan codes the keyboard can output in a 2d array printed on a data sheet.  It's rows and columns, when you push a key a switch there connects the row wires with the column wires at that point.  It would probably be in a manufacturer's datasheet, thought I had one for this.  The left and right shifts, ctrl, alt are different from each other.  Software can tell which shift key you use. OK, shift is 42 and 54 here.
  Reply
#46
In Debian we can just do:
dpkg-reconfigure keyboard-configuration
if you can remember that.  It's what raspi-config calls on a Raspberry Pi, but they borrowed it from Debian.

Nothing in there about how many keys a keyboard has, I'm set to a 105 key one which is probably why my numlock doesn't work, it's on the wrong keycode.  It asks for numbers of keys or brand and model, then in the 2nd step it asks for country.

Screenshot image:
https://imgur.com/gallery/qPcs0jp

Ah, /usr/share/console-setup/KeyboardNames.pl.  And it comes down to the way it's been done since 1995.  http://xfree86.org/current/XKBproto.pdf

It's not that hard to make a custom layout I think but first there's this 155 page PDF to at least skim.

But wait, you don't have to do it by hand, there's xkeycaps (in the debs).
https://imgur.com/gallery/4oCkVAA
[Image: 4oCkVAA]

Looks like the Athena widget set I think. Right-click in the top of a scrollbar to scroll up. Click in the bottom to scroll down. The scrollbars are why I like Motif better.
  Reply
#47
Try it with Fn. I suspect it doesn't report at all for Fn and most keys at the same time as Fn.
  Reply
#48
(04-15-2021, 08:19 PM)KC9UDX Wrote: Try it with Fn.  I suspect it doesn't report at all for Fn and most keys at the same time as Fn.
I have been.  If it's in blue I use Fn.  My NumLock is on the Print Screen and Pause buttons for some reason.  Which are both keycode 69 by showkey.  NumLock shows as 70.  Using Fn.

I can do showkey -s and get scancodes instead but each key shows 2 numbers, one for press and one for release I think.  My numlock key gets 0x46 and 0x66.  I thought I had better specs on this keyboard.
  Reply
#49
What I'm getting at though I'd that you're not seeing hardware scan values. Else a key with Fn would be the same code as if you pressed it without Fn, and Fn would report as a separate key, the way the other modifier keys do.
  Reply
#50
I guess you're right.  Fn  by itself doesn't register.

I was working along the top row keys and something killed my mouse cursor.  Letting it sit off and using a phone.
  Reply


Forum Jump:


Users browsing this thread: 10 Guest(s)