Commit | Line | Data |
---|---|---|
995c3141 JH |
1 | USB NKRO MEMO |
2 | ============= | |
3 | 2010/12/09 | |
4 | ||
5 | ||
6 | References | |
7 | ---------- | |
8 | USB - boot mode, NKRO, compatibility, etc... | |
9 | http://geekhack.org/showthread.php?t=13162 | |
10 | NKey Rollover - Overview, Testing Methodology, and Results | |
11 | http://geekhack.org/showwiki.php?title=NKey+Rollover+-+Overview+Testing+Methodology+and+Results | |
12 | dfj's NKRO(2010/06) | |
13 | http://geekhack.org/showpost.php?p=191195&postcount=251 | |
14 | http://geekhack.org/showthread.php?p=204389#post204389 | |
15 | ||
16 | ||
17 | Terminology | |
18 | --------- | |
19 | NKRO | |
20 | ghost | |
21 | matrix | |
22 | mechanical with diodes | |
23 | membrane | |
24 | ||
25 | ||
26 | OS Support Status | |
27 | ----------------- | |
28 | USB NKRO is possible *without* a custom driver. | |
29 | At least following OS's supports. | |
30 | Windows7 64bit | |
31 | WindowsXP | |
32 | Windows2000 SP4 | |
33 | Ubuntu10.4(Linux 2.6) | |
34 | MacOSX(To be tested) | |
35 | ||
36 | ||
37 | Custom Driver for USB NKRO | |
38 | -------------------------- | |
39 | NOT NEEDED | |
40 | at least when using following report formats on Windows, Linux or MacOSX. | |
41 | ||
42 | ||
43 | USB NKRO methods | |
44 | ---------------- | |
45 | 1. Virtual keyboards | |
46 | Keyboard can increase its KRO by using virtual keyboards with Standard or Extended report. | |
47 | If the keyboard has 2 virtual keyboard with Standard report(6KRO), it gets 12KRO. | |
48 | Using this method means the keyboard is a composite device. | |
49 | ||
50 | 2. Extended report | |
51 | It needs large report size for this method to achieve NKRO. | |
52 | If a keyboard has 101keys, it needs 103byte report. It seems to be inefficient. | |
53 | ||
54 | 3. Bitmap report | |
55 | If the keyboard has less than 128keys, 16byte report will be enough for NKRO. | |
56 | The 16byte report seems to be reasonable cost to get NKRO. | |
57 | ||
58 | ||
59 | Report Format | |
60 | ------------- | |
61 | Other report formats than followings are possible, though these format are typical one. | |
62 | ||
63 | 1. Standard 8bytes | |
64 | modifiers(bitmap) 1byte | |
65 | reserved 1byte(not used) | |
66 | keys(array) 1byte*6 | |
67 | Standard report can send 6keys plus 8modifiers simultaneously. | |
68 | Standard report is used by most keyboards in the marketplace. | |
69 | Standard report is identical to boot protocol report. | |
70 | Standard report is hard to suffer from compatibility problems. | |
71 | ||
72 | 2. Extended standard 16,32,64bytes | |
73 | modifiers(bitmap) 1byte | |
74 | reserved 1byte(not used) | |
75 | keys(array) 1byte*(14,32,62) | |
76 | Extended report can send N-keys by using N+2bytes. | |
77 | Extended report is expected to be compatible with boot protocol. | |
78 | ||
79 | 3. Bitmap 16,32,64bytes | |
80 | keys(bitmap) (16,32)bytes | |
81 | Bitmap report can send at most 128keys by 16bytes and 256keys by 32bytes. | |
82 | Bitmap report can achieve USB NKRO efficiently in terms of report size. | |
83 | Bitmap report needs a deliberation for boot protocol implementation. | |
84 | Bitmap report descriptor sample: | |
85 | 0x05, 0x01, // Usage Page (Generic Desktop), | |
86 | 0x09, 0x06, // Usage (Keyboard), | |
87 | 0xA1, 0x01, // Collection (Application), | |
88 | // bitmap of modifiers | |
89 | 0x75, 0x01, // Report Size (1), | |
90 | 0x95, 0x08, // Report Count (8), | |
91 | 0x05, 0x07, // Usage Page (Key Codes), | |
92 | 0x19, 0xE0, // Usage Minimum (224), | |
93 | 0x29, 0xE7, // Usage Maximum (231), | |
94 | 0x15, 0x00, // Logical Minimum (0), | |
95 | 0x25, 0x01, // Logical Maximum (1), | |
96 | 0x81, 0x02, // Input (Data, Variable, Absolute), ;Modifier byte | |
97 | // LED output report | |
98 | 0x95, 0x05, // Report Count (5), | |
99 | 0x75, 0x01, // Report Size (1), | |
100 | 0x05, 0x08, // Usage Page (LEDs), | |
101 | 0x19, 0x01, // Usage Minimum (1), | |
102 | 0x29, 0x05, // Usage Maximum (5), | |
103 | 0x91, 0x02, // Output (Data, Variable, Absolute), | |
104 | 0x95, 0x01, // Report Count (1), | |
105 | 0x75, 0x03, // Report Size (3), | |
106 | 0x91, 0x03, // Output (Constant), | |
107 | // bitmap of keys | |
108 | 0x95, (REPORT_BYTES-1)*8, // Report Count (), | |
109 | 0x75, 0x01, // Report Size (1), | |
110 | 0x15, 0x00, // Logical Minimum (0), | |
111 | 0x25, 0x01, // Logical Maximum(1), | |
112 | 0x05, 0x07, // Usage Page (Key Codes), | |
113 | 0x19, 0x00, // Usage Minimum (0), | |
114 | 0x29, (REPORT_BYTES-1)*8-1, // Usage Maximum (), | |
115 | 0x81, 0x02, // Input (Data, Variable, Absolute), | |
116 | 0xc0 // End Collection | |
117 | where REPORT_BYTES is a report size in bytes. | |
118 | ||
119 | ||
120 | Considerations | |
121 | -------------- | |
122 | Compatibility | |
123 | boot protocol | |
124 | minor/old system | |
125 | Some BIOS doesn't send SET_PROTOCOL request, a keyboard can't switch to boot protocol mode. | |
126 | This may cause a problem on a keyboard which uses other report than Standard. | |
127 | Reactivity | |
128 | USB polling time | |
129 | OS/Driver processing time | |
130 | ||
131 | ||
132 | Windows Problem | |
133 | --------------- | |
134 | 1. Windows accepts only 6keys in case of Standard report. | |
135 | It should be able to send 6keys plus 8modifiers. | |
136 | 2. Windows accepts only 10keys in case of 16bytes Extended report. | |
137 | It should be able to send 14keys plus 8modifiers. | |
138 | 3. Windows accepts only 18keys in case of 32bytes Extended report. | |
139 | It should be able to send 30keys plus 8modifiers. | |
140 | If keys are pressed in excess of the number, wrong keys are registered on Windows. | |
141 | ||
142 | This problem will be reportedly fixed soon.(2010/12/05) | |
143 | http://forums.anandtech.com/showpost.php?p=30873364&postcount=17 | |
144 | ||
145 | ||
146 | Tools for testing NKRO | |
147 | ---------------------- | |
148 | Browser App: | |
149 | http://www.microsoft.com/appliedsciences/content/projects/KeyboardGhostingDemo.aspx | |
150 | http://random.xem.us/rollover.html | |
151 | ||
152 | Windows: | |
153 | AquaKeyTest.exe http://geekhack.org/showthread.php?t=6643 | |
154 | ||
155 | Linux: | |
156 | xkeycaps | |
157 | xev | |
158 | showkeys | |
159 | ||
160 | EOF |