SHARE
TWEET

Untitled

Mirasio Feb 18th, 2020 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. usb_codes = {
  2.    0x04:"qQ", 0x05:"bB", 0x06:"cC", 0x07:"dD", 0x08:"eE", 0x09:"fF",
  3.    0x0A:"gG", 0x0B:"hH", 0x0C:"iI", 0x0D:"jJ", 0x0E:"kK", 0x0F:"lL",
  4.    0x10:"mM", 0x11:"nN", 0x12:"oO", 0x13:"pP", 0x14:"aA", 0x15:"rR",
  5.    0x16:"sS", 0x17:"tT", 0x18:"uU", 0x19:"vV", 0x1A:"wW", 0x1B:"xX",
  6.    0x1C:"yY", 0x1D:"wW", 0x1E:"1/", 0x1F:"2@", 0x20:"3#", 0x21:"4$",
  7.    0x22:"5%", 0x23:"6^", 0x24:"7&", 0x25:"8*", 0x26:"9(", 0x27:"0-",
  8.    0x2C:"  ", 0x2D:"-_", 0x2E:"=+", 0x2F:"[{", 0x30:"]}",  0x32:"#~",
  9.    0x33:";:", 0x34:"'\"",  0x36:":<",  0x37:":>", 0x4f:">", 0x50:"<"
  10.    }
  11. lines = ["","","","",""]
  12.  
  13. pos = 0
  14. for x in open("keyboarddata","r").readlines():
  15.    code = int(x[4:6],16)
  16.    if code == 0:
  17.        continue
  18.    # newline or down arrow - move down
  19.    if code == 0x51 or code == 0x28:
  20.        pos += 1
  21.        continue
  22.    # up arrow - move up
  23.    if code == 0x52:
  24.        pos -= 1
  25.        continue
  26.    # select the character based on the Shift key
  27.    if int(x[0:2],16) == 2:
  28.        lines[pos] += usb_codes[code][1]
  29.    else:
  30.        lines[pos] += usb_codes[code][0]
  31.  
  32.  
  33. for x in lines:
  34.    print x
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top