+ typestrings={
+ -1 : "Python does USB HID!\n", # Unidentified OS. This is the default typestring.
+ 0x00 : "OSX Hosts don't recognize Maxim keyboards.\n", # We have to identify as an Apple keyboard to get arround the unknown keyboard error.
+ 0xA1 : "Python does USB HID on Linux!\n",
+ 0x81 : " Python does USB HID on Windows!\n", # Windows requires a bit of a delay. Maybe we can watch for a keyboard reset command?
+ }
+ def typestring(self):
+ if self.typestrings.has_key(self.OsLastConfigType):
+ return self.typestrings[self.OsLastConfigType];
+ else:
+ return self.typestrings[-1];
+ # http://www.win.tue.nl/~aeb/linux/kbd/scancodes-14.html
+ # Escape=0x29 Backsp=0x2A Space=0x2C CapsLock=0x39 Menu=0x65
+ keymaps={
+ 'en_US' :[ ' abcdefghijklmnopqrstuvwxyz1234567890\n\e\7f\t -=[]\\\\;\'`,./',
+ ''' \ 1\ 2\ 3\ 4\ 5\ 6\a\b \v\f\r\ e\ f\10 \12 \14\15\16\17\18\19\1a''', # LeftCtrl
+ ' ABCDEFGHIJKLMNOPQRSTUVWXYZ!@#$%^&*() {}?+||:"~<>?', # LeftShift
+ '', # LeftCtrl & LeftShift
+ ' \ea\eb\ec'], # LeftAlt
+ 'Dvorak' :[ ' axje.uidchtnmbrl\'poygk,qf;1234567890\n\e\7f\t []/=\\\\s-`wvz',
+ ''' \ 1\18 \ 5 \15 \ 4\ 3\b\14\ e\r\ 2\12\f \10\ f\19\a\v \ 6 \17\16\1a''', # LeftCtrl
+ ' AXJE UIDCHTNMBRL"POYGK<QF:!@#$%^&*() {}?+||S_~WVZ', # LeftShift
+ '', # LeftCtrl & LeftShift
+ ' \ea\ex\ej'], # LeftAlt
+ }
+ layout='en_US';
+ def keymap(self):
+ return self.keymaps[self.layout];
+ modifiers={
+ 'None': 0b00000000,
+ 'LeftCtrl': 0b00000001,
+ 'LeftShift': 0b00000010,
+ 'LeftAlt': 0b00000100,
+ 'LeftGUI': 0b00001000,
+ 'RightCtrl': 0b00010000,
+ 'RightShift': 0b00100000,
+ 'RightAlt': 0b01000000,
+ 'RightGUI': 0b10000000
+ }
+