{
    "mode": "man",
    "parameter": "setkeycodes",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/setkeycodes/8/json",
    "generated": "2026-08-12T03:41:50Z",
    "synopsis": "setkeycodes scancode keycode ...",
    "sections": {
        "NAME": {
            "content": "setkeycodes - load kernel scancode-to-keycode mapping table entries\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "setkeycodes scancode keycode ...\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The  setkeycodes command reads its arguments two at a time, each pair of arguments consisting\nof a scancode (given in hexadecimal) and a keycode (given in decimal). For each such pair, it\ntells the kernel keyboard driver to map the specified scancode to the specified keycode.\n\nThis command is useful only for people with slightly unusual keyboards, that have a few  keys\nwhich produce scancodes that the kernel does not recognize.\n\n",
            "subsections": []
        },
        "THEORY": {
            "content": "The  usual  PC  keyboard  produces  a series of scancodes for each key press and key release.\n(Scancodes are shown by showkey -s, see showkey(1) ) The kernel parses this stream  of  scan‐\ncodes,  and  converts  it  to a stream of keycodes (key press/release events).  (Keycodes are\nshown by showkey.)  Apart from a few scancodes with special meaning, and apart from  the  se‐\nquence produced by the Pause key, and apart from shiftstate related scancodes, and apart from\nthe  key up/down bit, the stream of scancodes consists of unescaped scancodes xx (7 bits) and\nescaped scancodes e0 xx (8+7 bits).  To these scancodes or scancode  pairs,  a  corresponding\nkeycode can be assigned (in the range 1-127).  For example, if you have a Macro key that pro‐\nduces e0 6f according to showkey(1), the command\nsetkeycodes e06f 112\nwill assign the keycode 112 to it, and then loadkeys(1) can be used to define the function of\nthis key.\n\nSome  older  kernels  might hardwire a low scancode range to the equivalent keycodes; setkey‐\ncodes will fail when you try to remap these.\n\n\n2.6 KERNELS\nIn 2.6 kernels key codes lie in the range 1-255, instead of 1-127.  (It might be best to con‐\nfine oneself to the range 1-239.)\n\nIn 2.6 kernels raw mode, or scancode mode, is not very raw at  all.   The  code  returned  by\nshowkey -s will change after use of setkeycodes.  A kernel bug. See also showkey(1).\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "None.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "The  keycodes  of X have nothing to do with those of Linux.  Unusual keys can be made visible\nunder Linux, but not under X.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "dumpkeys(1), loadkeys(1), showkey(1), getkeycodes(8)\n\nkbd                                          8 Nov 1994                               SETKEYCODES(8)",
            "subsections": []
        }
    },
    "summary": "setkeycodes - load kernel scancode-to-keycode mapping table entries",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "dumpkeys",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/dumpkeys/1/json"
        },
        {
            "name": "loadkeys",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/loadkeys/1/json"
        },
        {
            "name": "showkey",
            "section": "1",
            "url": "https://www.chedong.com/phpMan.php/man/showkey/1/json"
        },
        {
            "name": "getkeycodes",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/getkeycodes/8/json"
        }
    ]
}