keycodes-to-ps2-scan-codes
Convert Web API keyCode
s to PS/2 keyboard scan codes (set 2).
Referenced from http://www.vetra.com/scancodes.html
Installation
npm i --save keycodes-to-ps2-scan-codes
Exports
getMakeBytes(keyCode: string): number[]
- Returns: a byte array to "make" the keypress for the specified
keyCode
. Throws if thekeyCode
is not mapped. - Example:const getMakeBytes =// [ 0x1C ]// [ 0xE0, 0x69 ]// throws - IntlRo is a valid `keyCode`, but it is not mappable to PS/2
getBreakBytes(keyCode: string): number[]
- Returns: a byte array to "break" the keypress for the specified
keyCode
. Throws if thekeyCode
is not mapped. - Example:const getBreakBytes =// [ 0xF0, 0x1C ]// [ 0xE0, 0xF0, 0x69 ]// throws - IntlRo is a valid `keyCode`, but it is not mappable to PS/2
keysToScanCodes: { [scanCode: string]: [number[], number[]] }
- Maps keyCodes to pairs of byte arrays, corresponding to the respective "make" and "break" commands.
- Example:const keysToScanCodes =keysToScanCodes'KeyA' // [ [ 0x1C ], [ 0xF0, 0x1C ] ]