1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 """HID constant definitions.
11 class DescriptorType(object):
14 See Device Class Definition for Human Interface Devices (HID) Version 1.11
17 HID
= usb_constants
.Type
.CLASS |
0x01
18 REPORT
= usb_constants
.Type
.CLASS |
0x02
19 PHYSICAL
= usb_constants
.Type
.CLASS |
0x03
25 See Device Class Definition for Human Interface Devices (HID) Version 1.11
33 class CollectionType(object):
36 See Device Class Definition for Human Interface Devices (HID) Version 1.11
48 class Request(object):
49 """Class specific requests.
51 See Device Class Definition for Human Interface Devices (HID) Version 1.11
62 class ReportType(object):
65 See Device Class Definition for Human Interface Devices (HID) Version 1.11
73 class ModifierKey(object):
74 """Keyboard modifier key report values.
76 See Device Class Definition for Human Interface Devices (HID) Version 1.11
77 section 8.3 and HID Usage Tables Version 1.1 Table 12.
90 """Keyboard LED report values.
92 See Device Class Definition for Human Interface Devices (HID) Version 1.11
93 section B.1 and HID Usage Tables Version 1.1 Table 13.
103 """Mouse button report values.
105 See Device Class Definition for Human Interface Devices (HID) Version 1.11
114 for key
, code
in zip(xrange(ord('a'), ord('z') + 1), xrange(4, 30)):
115 KEY_CODES
[chr(key
)] = code
116 for key
, code
in zip(xrange(ord('1'), ord('9') + 1), xrange(30, 39)):
117 KEY_CODES
[chr(key
)] = code
118 for key
, code
in zip(['Enter', 'Esc', 'Backspace', 'Tab', ' '], xrange(40, 45)):
119 KEY_CODES
[key
] = code
120 for key
, code
in zip('-=[]\\', xrange(45, 50)):
121 KEY_CODES
[key
] = code
122 for key
, code
in zip(';\'`,./', xrange(51, 57)):
123 KEY_CODES
[key
] = code
124 for key
, code
in zip(
125 ['CapsLock', 'F1', 'F2', 'F3', 'F4', 'F5', 'F6', 'F7', 'F8', 'F9', 'F10',
126 'F11', 'F12', 'PrintScreen', 'ScrollLock', 'Pause', 'Insert', 'Home',
127 'PageUp', 'PageDown', 'Delete', 'End', 'PageDown', 'RightArrow',
128 'LeftArrow', 'DownArrow', 'UpArrow', 'NumLock'],
130 KEY_CODES
[key
] = code
133 for key
, code
in zip(xrange(ord('A'), ord('Z') + 1), xrange(4, 30)):
134 SHIFT_KEY_CODES
[chr(key
)] = code
135 for key
, code
in zip('!@#$%^&*()', xrange(30, 40)):
136 SHIFT_KEY_CODES
[key
] = code
137 for key
, code
in zip('_+{}|', xrange(45, 50)):
138 SHIFT_KEY_CODES
[key
] = code
139 for key
, code
in zip(':"~<>?', xrange(51, 57)):
140 SHIFT_KEY_CODES
[key
] = code