Skip to content

Commit 957ad41

Browse files
committed
Add Scancode Set 2 for extra JIS-109 keys
1 parent a0af24c commit 957ad41

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ IBM PC or PC/XT.
260260
| Numpad0 | 0x52 | 0x70 |
261261
| NumpadPeriod | 0x53 | 0x71 |
262262
| - | -- | -- |
263+
| Oem9 | 0x7B | 0x67 |
264+
| Oem10 | 0x79 | 0x64 |
265+
| Oem11 | 0x70 | 0x13 |
266+
| Oem12 | 0x73 | 0x51 |
267+
| Oem13 | 0x7D | 0x6A |
268+
| - | -- | -- |
263269
| PrevTrack | 0xE010 | 0xE015 |
264270
| NextTrack | 0xE019 | 0xE04D |
265271
| Mute | 0xE020 | 0xE023 |

src/lib.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,18 @@ pub enum KeyCode {
320320
/// The Numppad Period/Delete Key
321321
NumpadPeriod,
322322

323+
// ========= JIS 109-key extra keys =========
324+
/// Extra JIS key (0x7B)
325+
Oem9,
326+
/// Extra JIS key (0x79)
327+
Oem10,
328+
/// Extra JIS key (0x70)
329+
Oem11,
330+
/// Extra JIS symbol key (0x73)
331+
Oem12,
332+
/// Extra JIS symbol key (0x7D)
333+
Oem13,
334+
323335
// ========= Extra Keys =========
324336
/// Multi-media keys - Previous Track
325337
PrevTrack,
@@ -347,16 +359,6 @@ pub enum KeyCode {
347359
RControl2,
348360
/// Used as a 'hidden' Right Alt Key (Print Screen = RAlt2 + PrntScr)
349361
RAlt2,
350-
/// Extra JIS key (0x7B)
351-
Oem9,
352-
/// Extra JIS key (0x79)
353-
Oem10,
354-
/// Extra JIS key (0x70)
355-
Oem11,
356-
/// Extra JIS symbol key (0x73)
357-
Oem12,
358-
/// Extra JIS symbol key (0x7D)
359-
Oem13,
360362
}
361363

362364
/// The new state for a key, as part of a key event.

src/scancodes/set2.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ impl ScancodeSet2 {
4040
0x0E => Ok(KeyCode::Oem8),
4141
0x11 => Ok(KeyCode::LAlt),
4242
0x12 => Ok(KeyCode::LShift),
43+
0x13 => Ok(KeyCode::Oem11),
4344
0x14 => Ok(KeyCode::LControl),
4445
0x15 => Ok(KeyCode::Q),
4546
0x16 => Ok(KeyCode::Key1),
@@ -83,6 +84,7 @@ impl ScancodeSet2 {
8384
0x4C => Ok(KeyCode::Oem1),
8485
0x4D => Ok(KeyCode::P),
8586
0x4E => Ok(KeyCode::OemMinus),
87+
0x51 => Ok(KeyCode::Oem12),
8688
0x52 => Ok(KeyCode::Oem3),
8789
0x54 => Ok(KeyCode::Oem4),
8890
0x55 => Ok(KeyCode::OemPlus),
@@ -92,8 +94,11 @@ impl ScancodeSet2 {
9294
0x5B => Ok(KeyCode::Oem6),
9395
0x5D => Ok(KeyCode::Oem7),
9496
0x61 => Ok(KeyCode::Oem5),
97+
0x64 => Ok(KeyCode::Oem10),
9598
0x66 => Ok(KeyCode::Backspace),
99+
0x67 => Ok(KeyCode::Oem9),
96100
0x69 => Ok(KeyCode::Numpad1),
101+
0x6A => Ok(KeyCode::Oem13),
97102
0x6B => Ok(KeyCode::Numpad4),
98103
0x6C => Ok(KeyCode::Numpad7),
99104
0x70 => Ok(KeyCode::Numpad0),
@@ -278,7 +283,7 @@ mod test {
278283
}
279284
codes.sort();
280285
println!("{:?}", codes);
281-
assert_eq!(codes.len(), 89);
282-
assert_eq!(errs.len(), 167);
286+
assert_eq!(codes.len(), 94);
287+
assert_eq!(errs.len(), 162);
283288
}
284289
}

0 commit comments

Comments
 (0)