Thursday, September 12, 2013

How to redefine / re-map keyboard in Windows

  In real life you may have some very inconvenient keyboard, or some applications may prefer
very frequently used keys for a very weak finger (such as Cntl in Emacs v.s Cntl is usually assign to you little finger).

  In Mac OSX you could easily reassign the keys in system administrator. But for Windows the original system does not provide such interface. There were some tool on the website you could easily find and use to modify the mapping. But if you want to map whatever you want and control everything by yourself. You may want to have a look at this blog.

  The following two links has provide useful introduction on how to modify the mapping through  Windows register. But they may not be very fully correctly. That's why I post this blog.
 
  Links:
  1. Download scan code reference from:
     http://msdn.microsoft.com/en-us/library/windows/hardware/gg463372.aspx
  2. Follow the instruction to change the register keys:
     http://www.howtogeek.com/howto/windows-vista/disable-caps-lock-key-in-windows-vista/

  Detailed Process:
 
  1. Find the related scan code file from the previous link 1 around page 33
     For example:
     Right Alt(scan 1 make) => E0 38
     Left Cntl(scan 1 make) => 1D    
  2. According to the instruction on previous link 2:
     Make from Right Alt => left Cntl should be (Scancode Map):
    
     0000 0000 0000 0000 0200 0000 1D00 38E0
     0000 0000
    
     There are two points need to notice:
     1. E0 38 should be reverse order as: 38 E0
     2. 1D    is actually short for 00 1D. Then revert the order in 8bit into 1D 00

  3. Generalizations
     The following three mappings:
     1. Right Alt => Left Cntl
     2. Right Win => Left Cntl
     3. Insert    => Nothing (0000)
    
     0000 0000 0000 0000 0400 0000 1D00 38E0
     1D00 5CE0 0000 52E0 0000 0000

prettify