From fed31254d612caf6b31a7e61171791410257b8fa Mon Sep 17 00:00:00 2001 From: Jan Trefil <8711792+htrefil@users.noreply.github.com> Date: Sat, 2 Sep 2023 14:42:08 +0200 Subject: [PATCH] Refactor keys, buttons, raw codes --- rkvm-input/src/abs.rs | 25 +- rkvm-input/src/convert.rs | 7 + rkvm-input/src/interceptor.rs | 1 + rkvm-input/src/interceptor/caps.rs | 1 + rkvm-input/src/key.rs | 10 +- rkvm-input/src/key/button.rs | 15 +- rkvm-input/src/key/keyboard.rs | 1965 ++++++++++++++-------------- rkvm-input/src/lib.rs | 1 + rkvm-input/src/rel.rs | 11 +- rkvm-input/src/sync.rs | 21 +- rkvm-input/src/writer.rs | 25 +- rkvm-net/src/version.rs | 2 +- rkvm-server/src/config.rs | 29 +- switch-keys.md | 34 +- 14 files changed, 1090 insertions(+), 1057 deletions(-) create mode 100644 rkvm-input/src/convert.rs diff --git a/rkvm-input/src/abs.rs b/rkvm-input/src/abs.rs index e3a53d0..7b38473 100644 --- a/rkvm-input/src/abs.rs +++ b/rkvm-input/src/abs.rs @@ -1,3 +1,4 @@ +use crate::convert::Convert; use crate::glue; use serde::{Deserialize, Serialize}; @@ -53,9 +54,11 @@ pub enum AbsAxis { MtToolY, } -impl AbsAxis { - pub(crate) fn from_raw(code: u16) -> Option { - let axis = match code as _ { +impl Convert for AbsAxis { + type Raw = u16; + + fn from_raw(raw: Self::Raw) -> Option { + let axis = match raw as _ { glue::ABS_X => Self::X, glue::ABS_Y => Self::Y, glue::ABS_Z => Self::Z, @@ -104,7 +107,7 @@ impl AbsAxis { Some(axis) } - pub(crate) fn to_raw(&self) -> Option { + fn to_raw(&self) -> Option { let code = match self { Self::X => glue::ABS_X, Self::Y => glue::ABS_Y, @@ -174,9 +177,11 @@ pub enum ToolType { Dial, } -impl ToolType { - pub(crate) fn from_raw(value: i32) -> Option { - let value = match value as _ { +impl Convert for ToolType { + type Raw = i32; + + fn from_raw(raw: Self::Raw) -> Option { + let r#type = match raw as _ { glue::MT_TOOL_FINGER => Self::Finger, glue::MT_TOOL_PEN => Self::Pen, glue::MT_TOOL_PALM => Self::Palm, @@ -184,10 +189,10 @@ impl ToolType { _ => return None, }; - Some(value) + Some(r#type) } - pub(crate) fn to_raw(&self) -> i32 { + fn to_raw(&self) -> Option { let value = match self { Self::Finger => glue::MT_TOOL_FINGER, Self::Pen => glue::MT_TOOL_PEN, @@ -195,6 +200,6 @@ impl ToolType { Self::Dial => glue::MT_TOOL_DIAL, }; - value as _ + Some(value as _) } } diff --git a/rkvm-input/src/convert.rs b/rkvm-input/src/convert.rs new file mode 100644 index 0000000..d05b4a3 --- /dev/null +++ b/rkvm-input/src/convert.rs @@ -0,0 +1,7 @@ +pub trait Convert: Sized { + type Raw; + + fn from_raw(raw: Self::Raw) -> Option; + + fn to_raw(&self) -> Option; +} diff --git a/rkvm-input/src/interceptor.rs b/rkvm-input/src/interceptor.rs index 242928f..c9e409c 100644 --- a/rkvm-input/src/interceptor.rs +++ b/rkvm-input/src/interceptor.rs @@ -3,6 +3,7 @@ mod caps; pub use caps::{AbsCaps, KeyCaps, RelCaps}; use crate::abs::{AbsAxis, AbsEvent, ToolType}; +use crate::convert::Convert; use crate::evdev::Evdev; use crate::event::Event; use crate::glue; diff --git a/rkvm-input/src/interceptor/caps.rs b/rkvm-input/src/interceptor/caps.rs index ce2757d..b5e7e08 100644 --- a/rkvm-input/src/interceptor/caps.rs +++ b/rkvm-input/src/interceptor/caps.rs @@ -1,4 +1,5 @@ use crate::abs::{AbsAxis, AbsInfo}; +use crate::convert::Convert; use crate::glue; use crate::interceptor::Interceptor; use crate::key::Key; diff --git a/rkvm-input/src/key.rs b/rkvm-input/src/key.rs index fa1cb25..f911e6c 100644 --- a/rkvm-input/src/key.rs +++ b/rkvm-input/src/key.rs @@ -4,6 +4,8 @@ mod keyboard; pub use button::Button; pub use keyboard::Keyboard; +use crate::convert::Convert; + use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Hash)] @@ -18,8 +20,10 @@ pub enum Key { Button(Button), } -impl Key { - pub(crate) fn from_raw(code: u16) -> Option { +impl Convert for Key { + type Raw = u16; + + fn from_raw(code: Self::Raw) -> Option { if let Some(key) = Keyboard::from_raw(code) { return Some(Self::Key(key)); } @@ -31,7 +35,7 @@ impl Key { None } - pub(crate) fn to_raw(&self) -> u16 { + fn to_raw(&self) -> Option { match self { Self::Key(key) => key.to_raw(), Self::Button(button) => button.to_raw(), diff --git a/rkvm-input/src/key/button.rs b/rkvm-input/src/key/button.rs index 4f1c70f..c3cb0a1 100644 --- a/rkvm-input/src/key/button.rs +++ b/rkvm-input/src/key/button.rs @@ -1,3 +1,4 @@ +use crate::convert::Convert; use crate::glue; use serde::{Deserialize, Serialize}; @@ -114,9 +115,11 @@ pub enum Button { TriggerHappy40, } -impl Button { - pub(crate) fn to_raw(&self) -> u16 { - let code = match self { +impl Convert for Button { + type Raw = u16; + + fn to_raw(&self) -> Option { + let raw = match self { Self::B0 => glue::BTN_0, Self::B1 => glue::BTN_1, Self::B2 => glue::BTN_2, @@ -227,11 +230,11 @@ impl Button { Self::TriggerHappy40 => glue::BTN_TRIGGER_HAPPY40, }; - code as _ + Some(raw as _) } - pub(crate) fn from_raw(code: u16) -> Option { - let button = match code as _ { + fn from_raw(raw: Self::Raw) -> Option { + let button = match raw as _ { glue::BTN_0 => Self::B0, glue::BTN_1 => Self::B1, glue::BTN_2 => Self::B2, diff --git a/rkvm-input/src/key/keyboard.rs b/rkvm-input/src/key/keyboard.rs index 6ab020a..b391941 100644 --- a/rkvm-input/src/key/keyboard.rs +++ b/rkvm-input/src/key/keyboard.rs @@ -1,3 +1,6 @@ +use crate::convert::Convert; +use crate::glue; + use serde::{Deserialize, Serialize}; #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize)] @@ -35,7 +38,6 @@ pub enum Keyboard { BrightnessMax, BrightnessMin, BrightnessToggle, - BrightnessZero, BrightnessDown, BrightnessUp, BrlDot1, @@ -91,7 +93,6 @@ pub enum Keyboard { Delete, DeleteFile, Digits, - Direction, Directory, DisplayOff, DisplayToggle, @@ -226,7 +227,7 @@ pub enum Keyboard { Kp9, KpAsterisk, KpComma, - KpDott, + KpDot, KpEnter, KpEqual, KpJpComma, @@ -406,8 +407,6 @@ pub enum Keyboard { Sat2, Save, Scale, - Screen, - Screenlock, Screensaver, ScrollDown, ScrollLock, @@ -473,7 +472,6 @@ pub enum Keyboard { VolumeUp, W, WakeUp, - Wimax, Wlan, WordProcessor, WpsButton, @@ -486,998 +484,989 @@ pub enum Keyboard { Yen, Z, ZenkakuHankaku, - Zoom, ZoomIn, ZoomOut, ZoomReset, } -impl Keyboard { - pub(crate) fn to_raw(&self) -> u16 { - use self::Keyboard::*; +impl Convert for Keyboard { + type Raw = u16; - match *self { - A => 0x001E, - Ab => 0x0196, - AddressBook => 0x01AD, - Again => 0x0081, - AlsToggle => 0x0230, - AltErase => 0x00DE, - Angle => 0x0173, - Apostrophe => 0x0028, - Appselect => 0x0244, - Archive => 0x0169, - AspectRatio => 0x0177, - Assistant => 0x0247, - AttendantOff => 0x021C, - AttendantOn => 0x021B, - AttendantToggle => 0x021D, - Audio => 0x0188, - AudioDesc => 0x026E, - Aux => 0x0186, - B => 0x0030, - Back => 0x009E, - Backslash => 0x002B, - Backspace => 0x000E, - BassBoost => 0x00D1, - Battery => 0x00EC, - Blue => 0x0191, - Bluetooth => 0x00ED, - Bookmarks => 0x009C, - Break => 0x019B, - BrightnessAuto => 0x00F4, - BrightnessCycle => 0x00F3, - BrightnessMax => 0x0251, - BrightnessMin => 0x0250, - BrightnessToggle => 0x01AF, - BrightnessZero => 0x00F4, - BrightnessDown => 0x00E0, - BrightnessUp => 0x00E1, - BrlDot1 => 0x01F1, - BrlDot10 => 0x01FA, - BrlDot2 => 0x01F2, - BrlDot3 => 0x01F3, - BrlDot4 => 0x01F4, - BrlDot5 => 0x01F5, - BrlDot6 => 0x01F6, - BrlDot7 => 0x01F7, - BrlDot8 => 0x01F8, - BrlDot9 => 0x01F9, - ButtonConfig => 0x0240, - C => 0x002E, - Calc => 0x008C, - Calendar => 0x018D, - Camera => 0x00D4, - CameraDown => 0x0218, - CameraFocus => 0x0210, - CameraLeft => 0x0219, - CameraRight => 0x021A, - CameraUp => 0x0217, - CameraZoomIn => 0x0215, - CameraZoomOut => 0x0216, - Cancel => 0x00DF, - CapsLock => 0x003A, - Cd => 0x017F, - Channel => 0x016B, - ChannelDown => 0x0193, - ChannelUp => 0x0192, - Chat => 0x00D8, - Clear => 0x0163, - Close => 0x00CE, - CloseCd => 0x00A0, - Coffee => 0x0098, - Comma => 0x0033, - Compose => 0x007F, - Computer => 0x009D, - Config => 0x00AB, - Connect => 0x00DA, - ContextMenu => 0x01B6, - Controlpanel => 0x0243, - Copy => 0x0085, - Cut => 0x0089, - CycleWindows => 0x009A, - D => 0x0020, - Dashboard => 0x00CC, - Data => 0x0277, - Database => 0x01AA, - DelEol => 0x01C0, - DelEos => 0x01C1, - DelLine => 0x01C3, - Delete => 0x006F, - DeleteFile => 0x0092, - Digits => 0x019D, - Direction => 0x0099, - Directory => 0x018A, - DisplayOff => 0x00F5, - DisplayToggle => 0x01AF, - Documents => 0x00EB, - Dollar => 0x01B2, - Dot => 0x0034, - Down => 0x006C, - Dvd => 0x0185, - E => 0x0012, - Edit => 0x00B0, - Editor => 0x01A6, - EjectCd => 0x00A1, - EjectCloseCd => 0x00A2, - Email => 0x00D7, - End => 0x006B, - Enter => 0x001C, - Epg => 0x016D, - Equal => 0x000D, - Esc => 0x0001, - Euro => 0x01B3, - Exit => 0x00AE, - F => 0x0021, - F1 => 0x003B, - F10 => 0x0044, - F11 => 0x0057, - F12 => 0x0058, - F13 => 0x00B7, - F14 => 0x00B8, - F15 => 0x00B9, - F16 => 0x00BA, - F17 => 0x00BB, - F18 => 0x00BC, - F19 => 0x00BD, - F2 => 0x003C, - F20 => 0x00BE, - F21 => 0x00BF, - F22 => 0x00C0, - F23 => 0x00C1, - F24 => 0x00C2, - F3 => 0x003D, - F4 => 0x003E, - F5 => 0x003F, - F6 => 0x0040, - F7 => 0x0041, - F8 => 0x0042, - F9 => 0x0043, - FastForward => 0x00D0, - FastReverse => 0x0275, - Favorites => 0x016C, - File => 0x0090, - Finance => 0x00DB, - Find => 0x0088, - First => 0x0194, - Fn => 0x01D0, - Fn1 => 0x01DE, - Fn2 => 0x01DF, - FnB => 0x01E4, - FnD => 0x01E0, - FnE => 0x01E1, - FnEsc => 0x01D1, - FnF => 0x01E2, - FnF1 => 0x01D2, - FnF10 => 0x01DB, - FnF11 => 0x01DC, - FnF12 => 0x01DD, - FnF2 => 0x01D3, - FnF3 => 0x01D4, - FnF4 => 0x01D5, - FnF5 => 0x01D6, - FnF6 => 0x01D7, - FnF7 => 0x01D8, - FnF8 => 0x01D9, - FnF9 => 0x01DA, - FnS => 0x01E3, - Forward => 0x009F, - ForwardMail => 0x00E9, - Frameback => 0x01B4, - FrameForward => 0x01B5, - Front => 0x0084, - FullScreen => 0x0174, - G => 0x0022, - Games => 0x01A1, - Goto => 0x0162, - GraphicsEditor => 0x01A8, - Grave => 0x0029, - Green => 0x018F, - H => 0x0023, - Hangeul => 0x007A, - Hanja => 0x007B, - Help => 0x008A, - Henkan => 0x005C, - Hiragana => 0x005B, - Home => 0x0066, - Homepage => 0x00AC, - Hp => 0x00D3, - I => 0x0017, - Images => 0x01BA, - Info => 0x0166, - InsLine => 0x01C2, - Insert => 0x006E, - Iso => 0x00AA, - J => 0x0024, - Journal => 0x0242, - K => 0x0025, - Katakana => 0x005A, - KatakanaHiragana => 0x005D, - KbdLayoutNext => 0x0248, - KbdLcdMenu1 => 0x02B8, - KbdLcdMenu2 => 0x02B9, - KbdLcdMenu3 => 0x02BA, - KbdLcdMenu4 => 0x02BB, - KbdLcdMenu5 => 0x02BC, - KbdIllumDown => 0x00E5, - KbdIllumToggle => 0x00E4, - KbdIllumUp => 0x00E6, - KbdInputAssistAccept => 0x0264, - KbdInputAssistCancel => 0x0265, - KbdInputAssistNext => 0x0261, - KbdInputAssistNextgroup => 0x0263, - KbdInputAssistPrev => 0x0260, - KbdInputAssistPrevgroup => 0x0262, - Keyboard => 0x0176, - Kp0 => 0x0052, - Kp1 => 0x004F, - Kp2 => 0x0050, - Kp3 => 0x0051, - Kp4 => 0x004B, - Kp5 => 0x004C, - Kp6 => 0x004D, - Kp7 => 0x0047, - Kp8 => 0x0048, - Kp9 => 0x0049, - KpAsterisk => 0x0037, - KpComma => 0x0079, - KpDott => 0x0053, - KpEnter => 0x0060, - KpEqual => 0x0075, - KpJpComma => 0x005F, - KpLeftParen => 0x00B3, - KpMinus => 0x004A, - KpPlus => 0x004E, - KpPlusMinus => 0x0076, - KpRightParen => 0x00B4, - KpSlash => 0x0062, - L => 0x0026, - Language => 0x0170, - Last => 0x0195, - Left => 0x0069, - LeftDown => 0x0269, - LeftUp => 0x0268, - LeftAlt => 0x0038, - LeftBrace => 0x001A, - LeftCtrl => 0x001D, - LeftMeta => 0x007D, - LeftShift => 0x002A, - LightsToggle => 0x021E, - LineFeed => 0x0065, - List => 0x018B, - LogOff => 0x01B1, - M => 0x0032, - Macro => 0x0070, - Macro1 => 0x0290, - Macro10 => 0x0299, - Macro11 => 0x029A, - Macro12 => 0x029B, - Macro13 => 0x029C, - Macro14 => 0x029D, - Macro15 => 0x029E, - Macro16 => 0x029F, - Macro17 => 0x02A0, - Macro18 => 0x02A1, - Macro19 => 0x02A2, - Macro2 => 0x0291, - Macro20 => 0x02A3, - Macro21 => 0x02A4, - Macro22 => 0x02A5, - Macro23 => 0x02A6, - Macro24 => 0x02A7, - Macro25 => 0x02A8, - Macro26 => 0x02A9, - Macro27 => 0x02AA, - Macro28 => 0x02AB, - Macro29 => 0x02AC, - Macro3 => 0x0292, - Macro30 => 0x02AD, - Macro4 => 0x0293, - Macro5 => 0x0294, - Macro6 => 0x0295, - Macro7 => 0x0296, - Macro8 => 0x0297, - Macro9 => 0x0298, - MacroPreset1 => 0x02B3, - MacroPreset2 => 0x02B4, - MacroPreset3 => 0x02B5, - MacroPresetCycle => 0x02B2, - MacroRecordStart => 0x02B0, - MacroRecordStop => 0x02B1, - Mail => 0x009B, - Media => 0x00E2, - MediaRepeat => 0x01B7, - MediaTopMenu => 0x026B, - Memo => 0x018C, - Menu => 0x008B, - Messenger => 0x01AE, - Mhp => 0x016F, - MicMute => 0x00F8, - Minus => 0x000C, - Mode => 0x0175, - Move => 0x00AF, - Mp3 => 0x0187, - MsDos => 0x0097, - Muhenkan => 0x005E, - Mute => 0x0071, - N => 0x0031, - N0 => 0x000B, - N1 => 0x0002, - N102nd => 0x0056, - N10ChannelsDown => 0x01B9, - N10ChannelsUp => 0x01B8, - N2 => 0x0003, - N3 => 0x0004, - N3dMode => 0x026F, - N4 => 0x0005, - N5 => 0x0006, - N6 => 0x0007, - N7 => 0x0008, - N8 => 0x0009, - N9 => 0x000A, - New => 0x00B5, - News => 0x01AB, - Next => 0x0197, - NextFavorite => 0x0270, - NextSong => 0x00A3, - Numeric0 => 0x0200, - Numeric1 => 0x0201, - Numeric11 => 0x026C, - Numeric12 => 0x026D, - Numeric2 => 0x0202, - Numeric3 => 0x0203, - Numeric4 => 0x0204, - Numeric5 => 0x0205, - Numeric6 => 0x0206, - Numeric7 => 0x0207, - Numeric8 => 0x0208, - Numeric9 => 0x0209, - NumericA => 0x020C, - NumericB => 0x020D, - NumericC => 0x020E, - NumericD => 0x020F, - NumericPound => 0x020B, - NumericStar => 0x020A, - NumLock => 0x0045, - O => 0x0018, - Ok => 0x0160, - OnscreenKeyboard => 0x0278, - Open => 0x0086, - Option => 0x0165, - P => 0x0019, - PageDown => 0x006D, - PageUp => 0x0068, - Paste => 0x0087, - Pause => 0x0077, - PauseRecord => 0x0272, - PauseCd => 0x00C9, - Pc => 0x0178, - Phone => 0x00A9, - Play => 0x00CF, - PlayCd => 0x00C8, - Player => 0x0183, - PlayPause => 0x00A4, - Power => 0x0074, - Power2 => 0x0164, - Presentation => 0x01A9, - Previous => 0x019C, - PreviousSong => 0x00A5, - Print => 0x00D2, - PrivacyScreenToggle => 0x0279, - Prog1 => 0x0094, - Prog2 => 0x0095, - Prog3 => 0x00CA, - Prog4 => 0x00CB, - Program => 0x016A, - Props => 0x0082, - Pvr => 0x016E, - Q => 0x0010, - Question => 0x00D6, - R => 0x0013, - Radio => 0x0181, - Record => 0x00A7, - Red => 0x018E, - Redo => 0x00B6, - Refresh => 0x00AD, - Reply => 0x00E8, - Reserved => 0x0000, - Restart => 0x0198, - Rewind => 0x00A8, - RfKill => 0x00F7, - Right => 0x006A, - RightDown => 0x0267, - RightUp => 0x0266, - RightAlt => 0x0064, - RightBrace => 0x001B, - RightCtrl => 0x0061, - RightMeta => 0x007E, - RightShift => 0x0036, - Ro => 0x0059, - RootMenu => 0x026A, - RotateDisplay => 0x0099, - RotateLockToggle => 0x0231, - S => 0x001F, - Sat => 0x017D, - Sat2 => 0x017E, - Save => 0x00EA, - Scale => 0x0078, - Screen => 0x0177, - Screenlock => 0x0098, - Screensaver => 0x0245, - ScrollDown => 0x00B2, - ScrollLock => 0x0046, - ScrollUp => 0x00B1, - Search => 0x00D9, - Select => 0x0161, - SelectiveScreenshot => 0x027A, - Semicolon => 0x0027, - Send => 0x00E7, - SendFile => 0x0091, - Setup => 0x008D, - Shop => 0x00DD, - Shuffle => 0x019A, - Slash => 0x0035, - Sleep => 0x008E, - Slow => 0x0199, - SlowReverse => 0x0276, - Sound => 0x00D5, - Space => 0x0039, - Spellcheck => 0x01B0, - Sport => 0x00DC, - Spreadsheet => 0x01A7, - Stop => 0x0080, - StopRecord => 0x0271, - StopCd => 0x00A6, - Subtitle => 0x0172, - Suspend => 0x00CD, - SwitchVideoMode => 0x00E3, - SysRq => 0x0063, - T => 0x0014, - Tab => 0x000F, - Tape => 0x0180, - TaskManager => 0x0241, - Teen => 0x019E, - Text => 0x0184, - Time => 0x0167, - Title => 0x0171, - TouchpadOff => 0x0214, - TouchpadOn => 0x0213, - TouchpadToggle => 0x0212, - Tuner => 0x0182, - Tv => 0x0179, - Tv2 => 0x017A, - Twen => 0x019F, - U => 0x0016, - Undo => 0x0083, - Unknown => 0x00F0, - Unmute => 0x0274, - Up => 0x0067, - Uwb => 0x00EF, - V => 0x002F, - Vcr => 0x017B, - Vcr2 => 0x017C, - Vendor => 0x0168, - Video => 0x0189, - VideoNext => 0x00F1, - VideoPrev => 0x00F2, - VideoPhone => 0x01A0, - Vod => 0x0273, - VoiceCommand => 0x0246, - VoiceMail => 0x01AC, - VolumeDown => 0x0072, - VolumeUp => 0x0073, - W => 0x0011, - WakeUp => 0x008F, - Wimax => 0x00F6, - Wlan => 0x00EE, - WordProcessor => 0x01A5, - WpsButton => 0x0211, - Wwan => 0x00F6, - Www => 0x0096, - X => 0x002D, - Xfer => 0x0093, - Y => 0x0015, - Yellow => 0x0190, - Yen => 0x007C, - Z => 0x002C, - ZenkakuHankaku => 0x0055, - Zoom => 0x0174, - ZoomIn => 0x01A2, - ZoomOut => 0x01A3, - ZoomReset => 0x01A4, - } + fn to_raw(&self) -> Option { + let raw = match *self { + Keyboard::A => glue::KEY_A, + Keyboard::Ab => glue::KEY_AB, + Keyboard::AddressBook => glue::KEY_ADDRESSBOOK, + Keyboard::Again => glue::KEY_AGAIN, + Keyboard::AlsToggle => glue::KEY_ALS_TOGGLE, + Keyboard::AltErase => glue::KEY_ALTERASE, + Keyboard::Angle => glue::KEY_ANGLE, + Keyboard::Apostrophe => glue::KEY_APOSTROPHE, + Keyboard::Appselect => glue::KEY_APPSELECT, + Keyboard::Archive => glue::KEY_ARCHIVE, + Keyboard::AspectRatio => glue::KEY_ASPECT_RATIO, + Keyboard::Assistant => glue::KEY_ASSISTANT, + Keyboard::AttendantOff => glue::KEY_ATTENDANT_OFF, + Keyboard::AttendantOn => glue::KEY_ATTENDANT_ON, + Keyboard::AttendantToggle => glue::KEY_ATTENDANT_TOGGLE, + Keyboard::Audio => glue::KEY_AUDIO, + Keyboard::AudioDesc => glue::KEY_AUDIO_DESC, + Keyboard::Aux => glue::KEY_AUX, + Keyboard::B => glue::KEY_B, + Keyboard::Back => glue::KEY_BACK, + Keyboard::Backslash => glue::KEY_BACKSLASH, + Keyboard::Backspace => glue::KEY_BACKSPACE, + Keyboard::BassBoost => glue::KEY_BASSBOOST, + Keyboard::Battery => glue::KEY_BATTERY, + Keyboard::Blue => glue::KEY_BLUE, + Keyboard::Bluetooth => glue::KEY_BLUETOOTH, + Keyboard::Bookmarks => glue::KEY_BOOKMARKS, + Keyboard::Break => glue::KEY_BREAK, + Keyboard::BrightnessAuto => glue::KEY_BRIGHTNESS_AUTO, + Keyboard::BrightnessCycle => glue::KEY_BRIGHTNESS_CYCLE, + Keyboard::BrightnessMax => glue::KEY_BRIGHTNESS_MAX, + Keyboard::BrightnessMin => glue::KEY_BRIGHTNESS_MIN, + Keyboard::BrightnessToggle => glue::KEY_BRIGHTNESS_TOGGLE, + Keyboard::BrightnessDown => glue::KEY_BRIGHTNESSDOWN, + Keyboard::BrightnessUp => glue::KEY_BRIGHTNESSUP, + Keyboard::BrlDot1 => glue::KEY_BRL_DOT1, + Keyboard::BrlDot10 => glue::KEY_BRL_DOT10, + Keyboard::BrlDot2 => glue::KEY_BRL_DOT2, + Keyboard::BrlDot3 => glue::KEY_BRL_DOT3, + Keyboard::BrlDot4 => glue::KEY_BRL_DOT4, + Keyboard::BrlDot5 => glue::KEY_BRL_DOT5, + Keyboard::BrlDot6 => glue::KEY_BRL_DOT6, + Keyboard::BrlDot7 => glue::KEY_BRL_DOT7, + Keyboard::BrlDot8 => glue::KEY_BRL_DOT8, + Keyboard::BrlDot9 => glue::KEY_BRL_DOT9, + Keyboard::ButtonConfig => glue::KEY_BUTTONCONFIG, + Keyboard::C => glue::KEY_C, + Keyboard::Calc => glue::KEY_CALC, + Keyboard::Calendar => glue::KEY_CALENDAR, + Keyboard::Camera => glue::KEY_CAMERA, + Keyboard::CameraDown => glue::KEY_CAMERA_DOWN, + Keyboard::CameraFocus => glue::KEY_CAMERA_FOCUS, + Keyboard::CameraLeft => glue::KEY_CAMERA_LEFT, + Keyboard::CameraRight => glue::KEY_CAMERA_RIGHT, + Keyboard::CameraUp => glue::KEY_CAMERA_UP, + Keyboard::CameraZoomIn => glue::KEY_CAMERA_ZOOMIN, + Keyboard::CameraZoomOut => glue::KEY_CAMERA_ZOOMOUT, + Keyboard::Cancel => glue::KEY_CANCEL, + Keyboard::CapsLock => glue::KEY_CAPSLOCK, + Keyboard::Cd => glue::KEY_CD, + Keyboard::Channel => glue::KEY_CHANNEL, + Keyboard::ChannelDown => glue::KEY_CHANNELDOWN, + Keyboard::ChannelUp => glue::KEY_CHANNELUP, + Keyboard::Chat => glue::KEY_CHAT, + Keyboard::Clear => glue::KEY_CLEAR, + Keyboard::Close => glue::KEY_CLOSE, + Keyboard::CloseCd => glue::KEY_CLOSECD, + Keyboard::Coffee => glue::KEY_COFFEE, + Keyboard::Comma => glue::KEY_COMMA, + Keyboard::Compose => glue::KEY_COMPOSE, + Keyboard::Computer => glue::KEY_COMPUTER, + Keyboard::Config => glue::KEY_CONFIG, + Keyboard::Connect => glue::KEY_CONNECT, + Keyboard::ContextMenu => glue::KEY_CONTEXT_MENU, + Keyboard::Controlpanel => glue::KEY_CONTROLPANEL, + Keyboard::Copy => glue::KEY_COPY, + Keyboard::Cut => glue::KEY_CUT, + Keyboard::CycleWindows => glue::KEY_CYCLEWINDOWS, + Keyboard::D => glue::KEY_D, + Keyboard::Dashboard => glue::KEY_DASHBOARD, + Keyboard::Data => glue::KEY_DATA, + Keyboard::Database => glue::KEY_DATABASE, + Keyboard::DelEol => glue::KEY_DEL_EOL, + Keyboard::DelEos => glue::KEY_DEL_EOS, + Keyboard::DelLine => glue::KEY_DEL_LINE, + Keyboard::Delete => glue::KEY_DELETE, + Keyboard::DeleteFile => glue::KEY_DELETEFILE, + Keyboard::Digits => glue::KEY_DIGITS, + Keyboard::Directory => glue::KEY_DIRECTORY, + Keyboard::DisplayOff => glue::KEY_DISPLAY_OFF, + Keyboard::DisplayToggle => glue::KEY_DISPLAYTOGGLE, + Keyboard::Documents => glue::KEY_DOCUMENTS, + Keyboard::Dollar => glue::KEY_DOLLAR, + Keyboard::Dot => glue::KEY_DOT, + Keyboard::Down => glue::KEY_DOWN, + Keyboard::Dvd => glue::KEY_DVD, + Keyboard::E => glue::KEY_E, + Keyboard::Edit => glue::KEY_EDIT, + Keyboard::Editor => glue::KEY_EDITOR, + Keyboard::EjectCd => glue::KEY_EJECTCD, + Keyboard::EjectCloseCd => glue::KEY_EJECTCLOSECD, + Keyboard::Email => glue::KEY_EMAIL, + Keyboard::End => glue::KEY_END, + Keyboard::Enter => glue::KEY_ENTER, + Keyboard::Epg => glue::KEY_EPG, + Keyboard::Equal => glue::KEY_EQUAL, + Keyboard::Esc => glue::KEY_ESC, + Keyboard::Euro => glue::KEY_EURO, + Keyboard::Exit => glue::KEY_EXIT, + Keyboard::F => glue::KEY_F, + Keyboard::F1 => glue::KEY_F1, + Keyboard::F10 => glue::KEY_F10, + Keyboard::F11 => glue::KEY_F11, + Keyboard::F12 => glue::KEY_F12, + Keyboard::F13 => glue::KEY_F13, + Keyboard::F14 => glue::KEY_F14, + Keyboard::F15 => glue::KEY_F15, + Keyboard::F16 => glue::KEY_F16, + Keyboard::F17 => glue::KEY_F17, + Keyboard::F18 => glue::KEY_F18, + Keyboard::F19 => glue::KEY_F19, + Keyboard::F2 => glue::KEY_F2, + Keyboard::F20 => glue::KEY_F20, + Keyboard::F21 => glue::KEY_F21, + Keyboard::F22 => glue::KEY_F22, + Keyboard::F23 => glue::KEY_F23, + Keyboard::F24 => glue::KEY_F24, + Keyboard::F3 => glue::KEY_F3, + Keyboard::F4 => glue::KEY_F4, + Keyboard::F5 => glue::KEY_F5, + Keyboard::F6 => glue::KEY_F6, + Keyboard::F7 => glue::KEY_F7, + Keyboard::F8 => glue::KEY_F8, + Keyboard::F9 => glue::KEY_F9, + Keyboard::FastForward => glue::KEY_FASTFORWARD, + Keyboard::FastReverse => glue::KEY_FASTREVERSE, + Keyboard::Favorites => glue::KEY_FAVORITES, + Keyboard::File => glue::KEY_FILE, + Keyboard::Finance => glue::KEY_FINANCE, + Keyboard::Find => glue::KEY_FIND, + Keyboard::First => glue::KEY_FIRST, + Keyboard::Fn => glue::KEY_FN, + Keyboard::Fn1 => glue::KEY_FN_1, + Keyboard::Fn2 => glue::KEY_FN_2, + Keyboard::FnB => glue::KEY_FN_B, + Keyboard::FnD => glue::KEY_FN_D, + Keyboard::FnE => glue::KEY_FN_E, + Keyboard::FnEsc => glue::KEY_FN_ESC, + Keyboard::FnF => glue::KEY_FN_F, + Keyboard::FnF1 => glue::KEY_FN_F1, + Keyboard::FnF10 => glue::KEY_FN_F10, + Keyboard::FnF11 => glue::KEY_FN_F11, + Keyboard::FnF12 => glue::KEY_FN_F12, + Keyboard::FnF2 => glue::KEY_FN_F2, + Keyboard::FnF3 => glue::KEY_FN_F3, + Keyboard::FnF4 => glue::KEY_FN_F4, + Keyboard::FnF5 => glue::KEY_FN_F5, + Keyboard::FnF6 => glue::KEY_FN_F6, + Keyboard::FnF7 => glue::KEY_FN_F7, + Keyboard::FnF8 => glue::KEY_FN_F8, + Keyboard::FnF9 => glue::KEY_FN_F9, + Keyboard::FnS => glue::KEY_FN_S, + Keyboard::Forward => glue::KEY_FORWARD, + Keyboard::ForwardMail => glue::KEY_FORWARDMAIL, + Keyboard::Frameback => glue::KEY_FRAMEBACK, + Keyboard::FrameForward => glue::KEY_FRAMEFORWARD, + Keyboard::Front => glue::KEY_FRONT, + Keyboard::FullScreen => glue::KEY_FULL_SCREEN, + Keyboard::G => glue::KEY_G, + Keyboard::Games => glue::KEY_GAMES, + Keyboard::Goto => glue::KEY_GOTO, + Keyboard::GraphicsEditor => glue::KEY_GRAPHICSEDITOR, + Keyboard::Grave => glue::KEY_GRAVE, + Keyboard::Green => glue::KEY_GREEN, + Keyboard::H => glue::KEY_H, + Keyboard::Hangeul => glue::KEY_HANGEUL, + Keyboard::Hanja => glue::KEY_HANJA, + Keyboard::Help => glue::KEY_HELP, + Keyboard::Henkan => glue::KEY_HENKAN, + Keyboard::Hiragana => glue::KEY_HIRAGANA, + Keyboard::Home => glue::KEY_HOME, + Keyboard::Homepage => glue::KEY_HOMEPAGE, + Keyboard::Hp => glue::KEY_HP, + Keyboard::I => glue::KEY_I, + Keyboard::Images => glue::KEY_IMAGES, + Keyboard::Info => glue::KEY_INFO, + Keyboard::InsLine => glue::KEY_INS_LINE, + Keyboard::Insert => glue::KEY_INSERT, + Keyboard::Iso => glue::KEY_ISO, + Keyboard::J => glue::KEY_J, + Keyboard::Journal => glue::KEY_JOURNAL, + Keyboard::K => glue::KEY_K, + Keyboard::Katakana => glue::KEY_KATAKANA, + Keyboard::KatakanaHiragana => glue::KEY_KATAKANAHIRAGANA, + Keyboard::KbdLayoutNext => glue::KEY_KBD_LAYOUT_NEXT, + Keyboard::KbdLcdMenu1 => glue::KEY_KBD_LCD_MENU1, + Keyboard::KbdLcdMenu2 => glue::KEY_KBD_LCD_MENU2, + Keyboard::KbdLcdMenu3 => glue::KEY_KBD_LCD_MENU3, + Keyboard::KbdLcdMenu4 => glue::KEY_KBD_LCD_MENU4, + Keyboard::KbdLcdMenu5 => glue::KEY_KBD_LCD_MENU5, + Keyboard::KbdIllumDown => glue::KEY_KBDILLUMDOWN, + Keyboard::KbdIllumToggle => glue::KEY_KBDILLUMTOGGLE, + Keyboard::KbdIllumUp => glue::KEY_KBDILLUMUP, + Keyboard::KbdInputAssistAccept => glue::KEY_KBDINPUTASSIST_ACCEPT, + Keyboard::KbdInputAssistCancel => glue::KEY_KBDINPUTASSIST_CANCEL, + Keyboard::KbdInputAssistNext => glue::KEY_KBDINPUTASSIST_NEXT, + Keyboard::KbdInputAssistNextgroup => glue::KEY_KBDINPUTASSIST_NEXTGROUP, + Keyboard::KbdInputAssistPrev => glue::KEY_KBDINPUTASSIST_PREV, + Keyboard::KbdInputAssistPrevgroup => glue::KEY_KBDINPUTASSIST_PREVGROUP, + Keyboard::Keyboard => glue::KEY_KEYBOARD, + Keyboard::Kp0 => glue::KEY_KP0, + Keyboard::Kp1 => glue::KEY_KP1, + Keyboard::Kp2 => glue::KEY_KP2, + Keyboard::Kp3 => glue::KEY_KP3, + Keyboard::Kp4 => glue::KEY_KP4, + Keyboard::Kp5 => glue::KEY_KP5, + Keyboard::Kp6 => glue::KEY_KP6, + Keyboard::Kp7 => glue::KEY_KP7, + Keyboard::Kp8 => glue::KEY_KP8, + Keyboard::Kp9 => glue::KEY_KP9, + Keyboard::KpAsterisk => glue::KEY_KPASTERISK, + Keyboard::KpComma => glue::KEY_KPCOMMA, + Keyboard::KpDot => glue::KEY_KPDOT, + Keyboard::KpEnter => glue::KEY_KPENTER, + Keyboard::KpEqual => glue::KEY_KPEQUAL, + Keyboard::KpJpComma => glue::KEY_KPJPCOMMA, + Keyboard::KpLeftParen => glue::KEY_KPLEFTPAREN, + Keyboard::KpMinus => glue::KEY_KPMINUS, + Keyboard::KpPlus => glue::KEY_KPPLUS, + Keyboard::KpPlusMinus => glue::KEY_KPPLUSMINUS, + Keyboard::KpRightParen => glue::KEY_KPRIGHTPAREN, + Keyboard::KpSlash => glue::KEY_KPSLASH, + Keyboard::L => glue::KEY_L, + Keyboard::Language => glue::KEY_LANGUAGE, + Keyboard::Last => glue::KEY_LAST, + Keyboard::Left => glue::KEY_LEFT, + Keyboard::LeftDown => glue::KEY_LEFT_DOWN, + Keyboard::LeftUp => glue::KEY_LEFT_UP, + Keyboard::LeftAlt => glue::KEY_LEFTALT, + Keyboard::LeftBrace => glue::KEY_LEFTBRACE, + Keyboard::LeftCtrl => glue::KEY_LEFTCTRL, + Keyboard::LeftMeta => glue::KEY_LEFTMETA, + Keyboard::LeftShift => glue::KEY_LEFTSHIFT, + Keyboard::LightsToggle => glue::KEY_LIGHTS_TOGGLE, + Keyboard::LineFeed => glue::KEY_LINEFEED, + Keyboard::List => glue::KEY_LIST, + Keyboard::LogOff => glue::KEY_LOGOFF, + Keyboard::M => glue::KEY_M, + Keyboard::Macro => glue::KEY_MACRO, + Keyboard::Macro1 => glue::KEY_MACRO1, + Keyboard::Macro10 => glue::KEY_MACRO10, + Keyboard::Macro11 => glue::KEY_MACRO11, + Keyboard::Macro12 => glue::KEY_MACRO12, + Keyboard::Macro13 => glue::KEY_MACRO13, + Keyboard::Macro14 => glue::KEY_MACRO14, + Keyboard::Macro15 => glue::KEY_MACRO15, + Keyboard::Macro16 => glue::KEY_MACRO16, + Keyboard::Macro17 => glue::KEY_MACRO17, + Keyboard::Macro18 => glue::KEY_MACRO18, + Keyboard::Macro19 => glue::KEY_MACRO19, + Keyboard::Macro2 => glue::KEY_MACRO2, + Keyboard::Macro20 => glue::KEY_MACRO20, + Keyboard::Macro21 => glue::KEY_MACRO21, + Keyboard::Macro22 => glue::KEY_MACRO22, + Keyboard::Macro23 => glue::KEY_MACRO23, + Keyboard::Macro24 => glue::KEY_MACRO24, + Keyboard::Macro25 => glue::KEY_MACRO25, + Keyboard::Macro26 => glue::KEY_MACRO26, + Keyboard::Macro27 => glue::KEY_MACRO27, + Keyboard::Macro28 => glue::KEY_MACRO28, + Keyboard::Macro29 => glue::KEY_MACRO29, + Keyboard::Macro3 => glue::KEY_MACRO3, + Keyboard::Macro30 => glue::KEY_MACRO30, + Keyboard::Macro4 => glue::KEY_MACRO4, + Keyboard::Macro5 => glue::KEY_MACRO5, + Keyboard::Macro6 => glue::KEY_MACRO6, + Keyboard::Macro7 => glue::KEY_MACRO7, + Keyboard::Macro8 => glue::KEY_MACRO8, + Keyboard::Macro9 => glue::KEY_MACRO9, + Keyboard::MacroPreset1 => glue::KEY_MACRO_PRESET1, + Keyboard::MacroPreset2 => glue::KEY_MACRO_PRESET2, + Keyboard::MacroPreset3 => glue::KEY_MACRO_PRESET3, + Keyboard::MacroPresetCycle => glue::KEY_MACRO_PRESET_CYCLE, + Keyboard::MacroRecordStart => glue::KEY_MACRO_RECORD_START, + Keyboard::MacroRecordStop => glue::KEY_MACRO_RECORD_STOP, + Keyboard::Mail => glue::KEY_MAIL, + Keyboard::Media => glue::KEY_MEDIA, + Keyboard::MediaRepeat => glue::KEY_MEDIA_REPEAT, + Keyboard::MediaTopMenu => glue::KEY_MEDIA_TOP_MENU, + Keyboard::Memo => glue::KEY_MEMO, + Keyboard::Menu => glue::KEY_MENU, + Keyboard::Messenger => glue::KEY_MESSENGER, + Keyboard::Mhp => glue::KEY_MHP, + Keyboard::MicMute => glue::KEY_MICMUTE, + Keyboard::Minus => glue::KEY_MINUS, + Keyboard::Mode => glue::KEY_MODE, + Keyboard::Move => glue::KEY_MOVE, + Keyboard::Mp3 => glue::KEY_MP3, + Keyboard::MsDos => glue::KEY_MSDOS, + Keyboard::Muhenkan => glue::KEY_MUHENKAN, + Keyboard::Mute => glue::KEY_MUTE, + Keyboard::N => glue::KEY_N, + Keyboard::N0 => glue::KEY_0, + Keyboard::N1 => glue::KEY_1, + Keyboard::N102nd => glue::KEY_102ND, + Keyboard::N10ChannelsDown => glue::KEY_10CHANNELSDOWN, + Keyboard::N10ChannelsUp => glue::KEY_10CHANNELSUP, + Keyboard::N2 => glue::KEY_2, + Keyboard::N3 => glue::KEY_3, + Keyboard::N3dMode => glue::KEY_3D_MODE, + Keyboard::N4 => glue::KEY_4, + Keyboard::N5 => glue::KEY_5, + Keyboard::N6 => glue::KEY_6, + Keyboard::N7 => glue::KEY_7, + Keyboard::N8 => glue::KEY_8, + Keyboard::N9 => glue::KEY_9, + Keyboard::New => glue::KEY_NEW, + Keyboard::News => glue::KEY_NEWS, + Keyboard::Next => glue::KEY_NEXT, + Keyboard::NextFavorite => glue::KEY_NEXT_FAVORITE, + Keyboard::NextSong => glue::KEY_NEXTSONG, + Keyboard::Numeric0 => glue::KEY_NUMERIC_0, + Keyboard::Numeric1 => glue::KEY_NUMERIC_1, + Keyboard::Numeric11 => glue::KEY_NUMERIC_11, + Keyboard::Numeric12 => glue::KEY_NUMERIC_12, + Keyboard::Numeric2 => glue::KEY_NUMERIC_2, + Keyboard::Numeric3 => glue::KEY_NUMERIC_3, + Keyboard::Numeric4 => glue::KEY_NUMERIC_4, + Keyboard::Numeric5 => glue::KEY_NUMERIC_5, + Keyboard::Numeric6 => glue::KEY_NUMERIC_6, + Keyboard::Numeric7 => glue::KEY_NUMERIC_7, + Keyboard::Numeric8 => glue::KEY_NUMERIC_8, + Keyboard::Numeric9 => glue::KEY_NUMERIC_9, + Keyboard::NumericA => glue::KEY_NUMERIC_A, + Keyboard::NumericB => glue::KEY_NUMERIC_B, + Keyboard::NumericC => glue::KEY_NUMERIC_C, + Keyboard::NumericD => glue::KEY_NUMERIC_D, + Keyboard::NumericPound => glue::KEY_NUMERIC_POUND, + Keyboard::NumericStar => glue::KEY_NUMERIC_STAR, + Keyboard::NumLock => glue::KEY_NUMLOCK, + Keyboard::O => glue::KEY_O, + Keyboard::Ok => glue::KEY_OK, + Keyboard::OnscreenKeyboard => glue::KEY_ONSCREEN_KEYBOARD, + Keyboard::Open => glue::KEY_OPEN, + Keyboard::Option => glue::KEY_OPTION, + Keyboard::P => glue::KEY_P, + Keyboard::PageDown => glue::KEY_PAGEDOWN, + Keyboard::PageUp => glue::KEY_PAGEUP, + Keyboard::Paste => glue::KEY_PASTE, + Keyboard::Pause => glue::KEY_PAUSE, + Keyboard::PauseRecord => glue::KEY_PAUSE_RECORD, + Keyboard::PauseCd => glue::KEY_PAUSECD, + Keyboard::Pc => glue::KEY_PC, + Keyboard::Phone => glue::KEY_PHONE, + Keyboard::Play => glue::KEY_PLAY, + Keyboard::PlayCd => glue::KEY_PLAYCD, + Keyboard::Player => glue::KEY_PLAYER, + Keyboard::PlayPause => glue::KEY_PLAYPAUSE, + Keyboard::Power => glue::KEY_POWER, + Keyboard::Power2 => glue::KEY_POWER2, + Keyboard::Presentation => glue::KEY_PRESENTATION, + Keyboard::Previous => glue::KEY_PREVIOUS, + Keyboard::PreviousSong => glue::KEY_PREVIOUSSONG, + Keyboard::Print => glue::KEY_PRINT, + Keyboard::PrivacyScreenToggle => glue::KEY_PRIVACY_SCREEN_TOGGLE, + Keyboard::Prog1 => glue::KEY_PROG1, + Keyboard::Prog2 => glue::KEY_PROG2, + Keyboard::Prog3 => glue::KEY_PROG3, + Keyboard::Prog4 => glue::KEY_PROG4, + Keyboard::Program => glue::KEY_PROGRAM, + Keyboard::Props => glue::KEY_PROPS, + Keyboard::Pvr => glue::KEY_PVR, + Keyboard::Q => glue::KEY_Q, + Keyboard::Question => glue::KEY_QUESTION, + Keyboard::R => glue::KEY_R, + Keyboard::Radio => glue::KEY_RADIO, + Keyboard::Record => glue::KEY_RECORD, + Keyboard::Red => glue::KEY_RED, + Keyboard::Redo => glue::KEY_REDO, + Keyboard::Refresh => glue::KEY_REFRESH, + Keyboard::Reply => glue::KEY_REPLY, + Keyboard::Reserved => glue::KEY_RESERVED, + Keyboard::Restart => glue::KEY_RESTART, + Keyboard::Rewind => glue::KEY_REWIND, + Keyboard::RfKill => glue::KEY_RFKILL, + Keyboard::Right => glue::KEY_RIGHT, + Keyboard::RightDown => glue::KEY_RIGHT_DOWN, + Keyboard::RightUp => glue::KEY_RIGHT_UP, + Keyboard::RightAlt => glue::KEY_RIGHTALT, + Keyboard::RightBrace => glue::KEY_RIGHTBRACE, + Keyboard::RightCtrl => glue::KEY_RIGHTCTRL, + Keyboard::RightMeta => glue::KEY_RIGHTMETA, + Keyboard::RightShift => glue::KEY_RIGHTSHIFT, + Keyboard::Ro => glue::KEY_RO, + Keyboard::RootMenu => glue::KEY_ROOT_MENU, + Keyboard::RotateDisplay => glue::KEY_ROTATE_DISPLAY, + Keyboard::RotateLockToggle => glue::KEY_ROTATE_LOCK_TOGGLE, + Keyboard::S => glue::KEY_S, + Keyboard::Sat => glue::KEY_SAT, + Keyboard::Sat2 => glue::KEY_SAT2, + Keyboard::Save => glue::KEY_SAVE, + Keyboard::Scale => glue::KEY_SCALE, + Keyboard::Screensaver => glue::KEY_SCREENSAVER, + Keyboard::ScrollDown => glue::KEY_SCROLLDOWN, + Keyboard::ScrollLock => glue::KEY_SCROLLLOCK, + Keyboard::ScrollUp => glue::KEY_SCROLLUP, + Keyboard::Search => glue::KEY_SEARCH, + Keyboard::Select => glue::KEY_SELECT, + Keyboard::SelectiveScreenshot => glue::KEY_SELECTIVE_SCREENSHOT, + Keyboard::Semicolon => glue::KEY_SEMICOLON, + Keyboard::Send => glue::KEY_SEND, + Keyboard::SendFile => glue::KEY_SENDFILE, + Keyboard::Setup => glue::KEY_SETUP, + Keyboard::Shop => glue::KEY_SHOP, + Keyboard::Shuffle => glue::KEY_SHUFFLE, + Keyboard::Slash => glue::KEY_SLASH, + Keyboard::Sleep => glue::KEY_SLEEP, + Keyboard::Slow => glue::KEY_SLOW, + Keyboard::SlowReverse => glue::KEY_SLOWREVERSE, + Keyboard::Sound => glue::KEY_SOUND, + Keyboard::Space => glue::KEY_SPACE, + Keyboard::Spellcheck => glue::KEY_SPELLCHECK, + Keyboard::Sport => glue::KEY_SPORT, + Keyboard::Spreadsheet => glue::KEY_SPREADSHEET, + Keyboard::Stop => glue::KEY_STOP, + Keyboard::StopRecord => glue::KEY_STOP_RECORD, + Keyboard::StopCd => glue::KEY_STOPCD, + Keyboard::Subtitle => glue::KEY_SUBTITLE, + Keyboard::Suspend => glue::KEY_SUSPEND, + Keyboard::SwitchVideoMode => glue::KEY_SWITCHVIDEOMODE, + Keyboard::SysRq => glue::KEY_SYSRQ, + Keyboard::T => glue::KEY_T, + Keyboard::Tab => glue::KEY_TAB, + Keyboard::Tape => glue::KEY_TAPE, + Keyboard::TaskManager => glue::KEY_TASKMANAGER, + Keyboard::Teen => glue::KEY_TEEN, + Keyboard::Text => glue::KEY_TEXT, + Keyboard::Time => glue::KEY_TIME, + Keyboard::Title => glue::KEY_TITLE, + Keyboard::TouchpadOff => glue::KEY_TOUCHPAD_OFF, + Keyboard::TouchpadOn => glue::KEY_TOUCHPAD_ON, + Keyboard::TouchpadToggle => glue::KEY_TOUCHPAD_TOGGLE, + Keyboard::Tuner => glue::KEY_TUNER, + Keyboard::Tv => glue::KEY_TV, + Keyboard::Tv2 => glue::KEY_TV2, + Keyboard::Twen => glue::KEY_TWEN, + Keyboard::U => glue::KEY_U, + Keyboard::Undo => glue::KEY_UNDO, + Keyboard::Unknown => glue::KEY_UNKNOWN, + Keyboard::Unmute => glue::KEY_UNMUTE, + Keyboard::Up => glue::KEY_UP, + Keyboard::Uwb => glue::KEY_UWB, + Keyboard::V => glue::KEY_V, + Keyboard::Vcr => glue::KEY_VCR, + Keyboard::Vcr2 => glue::KEY_VCR2, + Keyboard::Vendor => glue::KEY_VENDOR, + Keyboard::Video => glue::KEY_VIDEO, + Keyboard::VideoNext => glue::KEY_VIDEO_NEXT, + Keyboard::VideoPrev => glue::KEY_VIDEO_PREV, + Keyboard::VideoPhone => glue::KEY_VIDEOPHONE, + Keyboard::Vod => glue::KEY_VOD, + Keyboard::VoiceCommand => glue::KEY_VOICECOMMAND, + Keyboard::VoiceMail => glue::KEY_VOICEMAIL, + Keyboard::VolumeDown => glue::KEY_VOLUMEDOWN, + Keyboard::VolumeUp => glue::KEY_VOLUMEUP, + Keyboard::W => glue::KEY_W, + Keyboard::WakeUp => glue::KEY_WAKEUP, + Keyboard::Wlan => glue::KEY_WLAN, + Keyboard::WordProcessor => glue::KEY_WORDPROCESSOR, + Keyboard::WpsButton => glue::KEY_WPS_BUTTON, + Keyboard::Wwan => glue::KEY_WWAN, + Keyboard::Www => glue::KEY_WWW, + Keyboard::X => glue::KEY_X, + Keyboard::Xfer => glue::KEY_XFER, + Keyboard::Y => glue::KEY_Y, + Keyboard::Yellow => glue::KEY_YELLOW, + Keyboard::Yen => glue::KEY_YEN, + Keyboard::Z => glue::KEY_Z, + Keyboard::ZenkakuHankaku => glue::KEY_ZENKAKUHANKAKU, + Keyboard::ZoomIn => glue::KEY_ZOOMIN, + Keyboard::ZoomOut => glue::KEY_ZOOMOUT, + Keyboard::ZoomReset => glue::KEY_ZOOMRESET, + }; + + Some(raw as _) } - pub(crate) fn from_raw(code: u16) -> Option { - use self::Keyboard::*; - - // This is generated from linux headers, some patterns are unreachable, and we don't care. - #[allow(unreachable_patterns)] - let key = match code { - 0x001E => A, - 0x0196 => Ab, - 0x01AD => AddressBook, - 0x0081 => Again, - 0x0230 => AlsToggle, - 0x00DE => AltErase, - 0x0173 => Angle, - 0x0028 => Apostrophe, - 0x0244 => Appselect, - 0x0169 => Archive, - 0x0177 => AspectRatio, - 0x0247 => Assistant, - 0x021C => AttendantOff, - 0x021B => AttendantOn, - 0x021D => AttendantToggle, - 0x0188 => Audio, - 0x026E => AudioDesc, - 0x0186 => Aux, - 0x0030 => B, - 0x009E => Back, - 0x002B => Backslash, - 0x000E => Backspace, - 0x00D1 => BassBoost, - 0x00EC => Battery, - 0x0191 => Blue, - 0x00ED => Bluetooth, - 0x009C => Bookmarks, - 0x019B => Break, - 0x00F4 => BrightnessAuto, - 0x00F3 => BrightnessCycle, - 0x0251 => BrightnessMax, - 0x0250 => BrightnessMin, - 0x00E0 => BrightnessDown, - 0x00E1 => BrightnessUp, - 0x01F1 => BrlDot1, - 0x01FA => BrlDot10, - 0x01F2 => BrlDot2, - 0x01F3 => BrlDot3, - 0x01F4 => BrlDot4, - 0x01F5 => BrlDot5, - 0x01F6 => BrlDot6, - 0x01F7 => BrlDot7, - 0x01F8 => BrlDot8, - 0x01F9 => BrlDot9, - 0x0240 => ButtonConfig, - 0x002E => C, - 0x008C => Calc, - 0x018D => Calendar, - 0x00D4 => Camera, - 0x0218 => CameraDown, - 0x0210 => CameraFocus, - 0x0219 => CameraLeft, - 0x021A => CameraRight, - 0x0217 => CameraUp, - 0x0215 => CameraZoomIn, - 0x0216 => CameraZoomOut, - 0x00DF => Cancel, - 0x003A => CapsLock, - 0x017F => Cd, - 0x016B => Channel, - 0x0193 => ChannelDown, - 0x0192 => ChannelUp, - 0x00D8 => Chat, - 0x0163 => Clear, - 0x00CE => Close, - 0x00A0 => CloseCd, - 0x0098 => Coffee, - 0x0033 => Comma, - 0x007F => Compose, - 0x009D => Computer, - 0x00AB => Config, - 0x00DA => Connect, - 0x01B6 => ContextMenu, - 0x0243 => Controlpanel, - 0x0085 => Copy, - 0x0089 => Cut, - 0x009A => CycleWindows, - 0x0020 => D, - 0x00CC => Dashboard, - 0x0277 => Data, - 0x01AA => Database, - 0x01C0 => DelEol, - 0x01C1 => DelEos, - 0x01C3 => DelLine, - 0x006F => Delete, - 0x0092 => DeleteFile, - 0x019D => Digits, - 0x018A => Directory, - 0x00F5 => DisplayOff, - 0x01AF => DisplayToggle, - 0x00EB => Documents, - 0x01B2 => Dollar, - 0x0034 => Dot, - 0x006C => Down, - 0x0185 => Dvd, - 0x0012 => E, - 0x00B0 => Edit, - 0x01A6 => Editor, - 0x00A1 => EjectCd, - 0x00A2 => EjectCloseCd, - 0x00D7 => Email, - 0x006B => End, - 0x001C => Enter, - 0x016D => Epg, - 0x000D => Equal, - 0x0001 => Esc, - 0x01B3 => Euro, - 0x00AE => Exit, - 0x0021 => F, - 0x003B => F1, - 0x0044 => F10, - 0x0057 => F11, - 0x0058 => F12, - 0x00B7 => F13, - 0x00B8 => F14, - 0x00B9 => F15, - 0x00BA => F16, - 0x00BB => F17, - 0x00BC => F18, - 0x00BD => F19, - 0x003C => F2, - 0x00BE => F20, - 0x00BF => F21, - 0x00C0 => F22, - 0x00C1 => F23, - 0x00C2 => F24, - 0x003D => F3, - 0x003E => F4, - 0x003F => F5, - 0x0040 => F6, - 0x0041 => F7, - 0x0042 => F8, - 0x0043 => F9, - 0x00D0 => FastForward, - 0x0275 => FastReverse, - 0x016C => Favorites, - 0x0090 => File, - 0x00DB => Finance, - 0x0088 => Find, - 0x0194 => First, - 0x01D0 => Fn, - 0x01DE => Fn1, - 0x01DF => Fn2, - 0x01E4 => FnB, - 0x01E0 => FnD, - 0x01E1 => FnE, - 0x01D1 => FnEsc, - 0x01E2 => FnF, - 0x01D2 => FnF1, - 0x01DB => FnF10, - 0x01DC => FnF11, - 0x01DD => FnF12, - 0x01D3 => FnF2, - 0x01D4 => FnF3, - 0x01D5 => FnF4, - 0x01D6 => FnF5, - 0x01D7 => FnF6, - 0x01D8 => FnF7, - 0x01D9 => FnF8, - 0x01DA => FnF9, - 0x01E3 => FnS, - 0x009F => Forward, - 0x00E9 => ForwardMail, - 0x01B4 => Frameback, - 0x01B5 => FrameForward, - 0x0084 => Front, - 0x0174 => FullScreen, - 0x0022 => G, - 0x01A1 => Games, - 0x0162 => Goto, - 0x01A8 => GraphicsEditor, - 0x0029 => Grave, - 0x018F => Green, - 0x0023 => H, - 0x007A => Hangeul, - 0x007B => Hanja, - 0x008A => Help, - 0x005C => Henkan, - 0x005B => Hiragana, - 0x0066 => Home, - 0x00AC => Homepage, - 0x00D3 => Hp, - 0x0017 => I, - 0x01BA => Images, - 0x0166 => Info, - 0x01C2 => InsLine, - 0x006E => Insert, - 0x00AA => Iso, - 0x0024 => J, - 0x0242 => Journal, - 0x0025 => K, - 0x005A => Katakana, - 0x005D => KatakanaHiragana, - 0x0248 => KbdLayoutNext, - 0x02B8 => KbdLcdMenu1, - 0x02B9 => KbdLcdMenu2, - 0x02BA => KbdLcdMenu3, - 0x02BB => KbdLcdMenu4, - 0x02BC => KbdLcdMenu5, - 0x00E5 => KbdIllumDown, - 0x00E4 => KbdIllumToggle, - 0x00E6 => KbdIllumUp, - 0x0264 => KbdInputAssistAccept, - 0x0265 => KbdInputAssistCancel, - 0x0261 => KbdInputAssistNext, - 0x0263 => KbdInputAssistNextgroup, - 0x0260 => KbdInputAssistPrev, - 0x0262 => KbdInputAssistPrevgroup, - 0x0176 => Keyboard, - 0x0052 => Kp0, - 0x004F => Kp1, - 0x0050 => Kp2, - 0x0051 => Kp3, - 0x004B => Kp4, - 0x004C => Kp5, - 0x004D => Kp6, - 0x0047 => Kp7, - 0x0048 => Kp8, - 0x0049 => Kp9, - 0x0037 => KpAsterisk, - 0x0079 => KpComma, - 0x0053 => KpDott, - 0x0060 => KpEnter, - 0x0075 => KpEqual, - 0x005F => KpJpComma, - 0x00B3 => KpLeftParen, - 0x004A => KpMinus, - 0x004E => KpPlus, - 0x0076 => KpPlusMinus, - 0x00B4 => KpRightParen, - 0x0062 => KpSlash, - 0x0026 => L, - 0x0170 => Language, - 0x0195 => Last, - 0x0069 => Left, - 0x0269 => LeftDown, - 0x0268 => LeftUp, - 0x0038 => LeftAlt, - 0x001A => LeftBrace, - 0x001D => LeftCtrl, - 0x007D => LeftMeta, - 0x002A => LeftShift, - 0x021E => LightsToggle, - 0x0065 => LineFeed, - 0x018B => List, - 0x01B1 => LogOff, - 0x0032 => M, - 0x0070 => Macro, - 0x0290 => Macro1, - 0x0299 => Macro10, - 0x029A => Macro11, - 0x029B => Macro12, - 0x029C => Macro13, - 0x029D => Macro14, - 0x029E => Macro15, - 0x029F => Macro16, - 0x02A0 => Macro17, - 0x02A1 => Macro18, - 0x02A2 => Macro19, - 0x0291 => Macro2, - 0x02A3 => Macro20, - 0x02A4 => Macro21, - 0x02A5 => Macro22, - 0x02A6 => Macro23, - 0x02A7 => Macro24, - 0x02A8 => Macro25, - 0x02A9 => Macro26, - 0x02AA => Macro27, - 0x02AB => Macro28, - 0x02AC => Macro29, - 0x0292 => Macro3, - 0x02AD => Macro30, - 0x0293 => Macro4, - 0x0294 => Macro5, - 0x0295 => Macro6, - 0x0296 => Macro7, - 0x0297 => Macro8, - 0x0298 => Macro9, - 0x02B3 => MacroPreset1, - 0x02B4 => MacroPreset2, - 0x02B5 => MacroPreset3, - 0x02B2 => MacroPresetCycle, - 0x02B0 => MacroRecordStart, - 0x02B1 => MacroRecordStop, - 0x009B => Mail, - 0x00E2 => Media, - 0x01B7 => MediaRepeat, - 0x026B => MediaTopMenu, - 0x018C => Memo, - 0x008B => Menu, - 0x01AE => Messenger, - 0x016F => Mhp, - 0x00F8 => MicMute, - 0x000C => Minus, - 0x0175 => Mode, - 0x00AF => Move, - 0x0187 => Mp3, - 0x0097 => MsDos, - 0x005E => Muhenkan, - 0x0071 => Mute, - 0x0031 => N, - 0x000B => N0, - 0x0002 => N1, - 0x0056 => N102nd, - 0x01B9 => N10ChannelsDown, - 0x01B8 => N10ChannelsUp, - 0x0003 => N2, - 0x0004 => N3, - 0x026F => N3dMode, - 0x0005 => N4, - 0x0006 => N5, - 0x0007 => N6, - 0x0008 => N7, - 0x0009 => N8, - 0x000A => N9, - 0x00B5 => New, - 0x01AB => News, - 0x0197 => Next, - 0x0270 => NextFavorite, - 0x00A3 => NextSong, - 0x0200 => Numeric0, - 0x0201 => Numeric1, - 0x026C => Numeric11, - 0x026D => Numeric12, - 0x0202 => Numeric2, - 0x0203 => Numeric3, - 0x0204 => Numeric4, - 0x0205 => Numeric5, - 0x0206 => Numeric6, - 0x0207 => Numeric7, - 0x0208 => Numeric8, - 0x0209 => Numeric9, - 0x020C => NumericA, - 0x020D => NumericB, - 0x020E => NumericC, - 0x020F => NumericD, - 0x020B => NumericPound, - 0x020A => NumericStar, - 0x0045 => NumLock, - 0x0018 => O, - 0x0160 => Ok, - 0x0278 => OnscreenKeyboard, - 0x0086 => Open, - 0x0165 => Option, - 0x0019 => P, - 0x006D => PageDown, - 0x0068 => PageUp, - 0x0087 => Paste, - 0x0077 => Pause, - 0x0272 => PauseRecord, - 0x00C9 => PauseCd, - 0x0178 => Pc, - 0x00A9 => Phone, - 0x00CF => Play, - 0x00C8 => PlayCd, - 0x0183 => Player, - 0x00A4 => PlayPause, - 0x0074 => Power, - 0x0164 => Power2, - 0x01A9 => Presentation, - 0x019C => Previous, - 0x00A5 => PreviousSong, - 0x00D2 => Print, - 0x0279 => PrivacyScreenToggle, - 0x0094 => Prog1, - 0x0095 => Prog2, - 0x00CA => Prog3, - 0x00CB => Prog4, - 0x016A => Program, - 0x0082 => Props, - 0x016E => Pvr, - 0x0010 => Q, - 0x00D6 => Question, - 0x0013 => R, - 0x0181 => Radio, - 0x00A7 => Record, - 0x018E => Red, - 0x00B6 => Redo, - 0x00AD => Refresh, - 0x00E8 => Reply, - 0x0000 => Reserved, - 0x0198 => Restart, - 0x00A8 => Rewind, - 0x00F7 => RfKill, - 0x006A => Right, - 0x0267 => RightDown, - 0x0266 => RightUp, - 0x0064 => RightAlt, - 0x001B => RightBrace, - 0x0061 => RightCtrl, - 0x007E => RightMeta, - 0x0036 => RightShift, - 0x0059 => Ro, - 0x026A => RootMenu, - 0x0099 => RotateDisplay, - 0x0231 => RotateLockToggle, - 0x001F => S, - 0x017D => Sat, - 0x017E => Sat2, - 0x00EA => Save, - 0x0078 => Scale, - 0x0245 => Screensaver, - 0x00B2 => ScrollDown, - 0x0046 => ScrollLock, - 0x00B1 => ScrollUp, - 0x00D9 => Search, - 0x0161 => Select, - 0x027A => SelectiveScreenshot, - 0x0027 => Semicolon, - 0x00E7 => Send, - 0x0091 => SendFile, - 0x008D => Setup, - 0x00DD => Shop, - 0x019A => Shuffle, - 0x0035 => Slash, - 0x008E => Sleep, - 0x0199 => Slow, - 0x0276 => SlowReverse, - 0x00D5 => Sound, - 0x0039 => Space, - 0x01B0 => Spellcheck, - 0x00DC => Sport, - 0x01A7 => Spreadsheet, - 0x0080 => Stop, - 0x0271 => StopRecord, - 0x00A6 => StopCd, - 0x0172 => Subtitle, - 0x00CD => Suspend, - 0x00E3 => SwitchVideoMode, - 0x0063 => SysRq, - 0x0014 => T, - 0x000F => Tab, - 0x0180 => Tape, - 0x0241 => TaskManager, - 0x019E => Teen, - 0x0184 => Text, - 0x0167 => Time, - 0x0171 => Title, - 0x0214 => TouchpadOff, - 0x0213 => TouchpadOn, - 0x0212 => TouchpadToggle, - 0x0182 => Tuner, - 0x0179 => Tv, - 0x017A => Tv2, - 0x019F => Twen, - 0x0016 => U, - 0x0083 => Undo, - 0x00F0 => Unknown, - 0x0274 => Unmute, - 0x0067 => Up, - 0x00EF => Uwb, - 0x002F => V, - 0x017B => Vcr, - 0x017C => Vcr2, - 0x0168 => Vendor, - 0x0189 => Video, - 0x00F1 => VideoNext, - 0x00F2 => VideoPrev, - 0x01A0 => VideoPhone, - 0x0273 => Vod, - 0x0246 => VoiceCommand, - 0x01AC => VoiceMail, - 0x0072 => VolumeDown, - 0x0073 => VolumeUp, - 0x0011 => W, - 0x008F => WakeUp, - 0x00EE => Wlan, - 0x01A5 => WordProcessor, - 0x0211 => WpsButton, - 0x00F6 => Wwan, - 0x0096 => Www, - 0x002D => X, - 0x0093 => Xfer, - 0x0015 => Y, - 0x0190 => Yellow, - 0x007C => Yen, - 0x002C => Z, - 0x0055 => ZenkakuHankaku, - 0x01A2 => ZoomIn, - 0x01A3 => ZoomOut, - 0x01A4 => ZoomReset, + fn from_raw(raw: Self::Raw) -> Option { + let keyboard = match raw as _ { + glue::KEY_A => Keyboard::A, + glue::KEY_AB => Keyboard::Ab, + glue::KEY_ADDRESSBOOK => Keyboard::AddressBook, + glue::KEY_AGAIN => Keyboard::Again, + glue::KEY_ALS_TOGGLE => Keyboard::AlsToggle, + glue::KEY_ALTERASE => Keyboard::AltErase, + glue::KEY_ANGLE => Keyboard::Angle, + glue::KEY_APOSTROPHE => Keyboard::Apostrophe, + glue::KEY_APPSELECT => Keyboard::Appselect, + glue::KEY_ARCHIVE => Keyboard::Archive, + glue::KEY_ASPECT_RATIO => Keyboard::AspectRatio, + glue::KEY_ASSISTANT => Keyboard::Assistant, + glue::KEY_ATTENDANT_OFF => Keyboard::AttendantOff, + glue::KEY_ATTENDANT_ON => Keyboard::AttendantOn, + glue::KEY_ATTENDANT_TOGGLE => Keyboard::AttendantToggle, + glue::KEY_AUDIO => Keyboard::Audio, + glue::KEY_AUDIO_DESC => Keyboard::AudioDesc, + glue::KEY_AUX => Keyboard::Aux, + glue::KEY_B => Keyboard::B, + glue::KEY_BACK => Keyboard::Back, + glue::KEY_BACKSLASH => Keyboard::Backslash, + glue::KEY_BACKSPACE => Keyboard::Backspace, + glue::KEY_BASSBOOST => Keyboard::BassBoost, + glue::KEY_BATTERY => Keyboard::Battery, + glue::KEY_BLUE => Keyboard::Blue, + glue::KEY_BLUETOOTH => Keyboard::Bluetooth, + glue::KEY_BOOKMARKS => Keyboard::Bookmarks, + glue::KEY_BREAK => Keyboard::Break, + glue::KEY_BRIGHTNESS_AUTO => Keyboard::BrightnessAuto, + glue::KEY_BRIGHTNESS_CYCLE => Keyboard::BrightnessCycle, + glue::KEY_BRIGHTNESS_MAX => Keyboard::BrightnessMax, + glue::KEY_BRIGHTNESS_MIN => Keyboard::BrightnessMin, + glue::KEY_BRIGHTNESS_TOGGLE => Keyboard::BrightnessToggle, + glue::KEY_BRIGHTNESSDOWN => Keyboard::BrightnessDown, + glue::KEY_BRIGHTNESSUP => Keyboard::BrightnessUp, + glue::KEY_BRL_DOT1 => Keyboard::BrlDot1, + glue::KEY_BRL_DOT10 => Keyboard::BrlDot10, + glue::KEY_BRL_DOT2 => Keyboard::BrlDot2, + glue::KEY_BRL_DOT3 => Keyboard::BrlDot3, + glue::KEY_BRL_DOT4 => Keyboard::BrlDot4, + glue::KEY_BRL_DOT5 => Keyboard::BrlDot5, + glue::KEY_BRL_DOT6 => Keyboard::BrlDot6, + glue::KEY_BRL_DOT7 => Keyboard::BrlDot7, + glue::KEY_BRL_DOT8 => Keyboard::BrlDot8, + glue::KEY_BRL_DOT9 => Keyboard::BrlDot9, + glue::KEY_BUTTONCONFIG => Keyboard::ButtonConfig, + glue::KEY_C => Keyboard::C, + glue::KEY_CALC => Keyboard::Calc, + glue::KEY_CALENDAR => Keyboard::Calendar, + glue::KEY_CAMERA => Keyboard::Camera, + glue::KEY_CAMERA_DOWN => Keyboard::CameraDown, + glue::KEY_CAMERA_FOCUS => Keyboard::CameraFocus, + glue::KEY_CAMERA_LEFT => Keyboard::CameraLeft, + glue::KEY_CAMERA_RIGHT => Keyboard::CameraRight, + glue::KEY_CAMERA_UP => Keyboard::CameraUp, + glue::KEY_CAMERA_ZOOMIN => Keyboard::CameraZoomIn, + glue::KEY_CAMERA_ZOOMOUT => Keyboard::CameraZoomOut, + glue::KEY_CANCEL => Keyboard::Cancel, + glue::KEY_CAPSLOCK => Keyboard::CapsLock, + glue::KEY_CD => Keyboard::Cd, + glue::KEY_CHANNEL => Keyboard::Channel, + glue::KEY_CHANNELDOWN => Keyboard::ChannelDown, + glue::KEY_CHANNELUP => Keyboard::ChannelUp, + glue::KEY_CHAT => Keyboard::Chat, + glue::KEY_CLEAR => Keyboard::Clear, + glue::KEY_CLOSE => Keyboard::Close, + glue::KEY_CLOSECD => Keyboard::CloseCd, + glue::KEY_COFFEE => Keyboard::Coffee, + glue::KEY_COMMA => Keyboard::Comma, + glue::KEY_COMPOSE => Keyboard::Compose, + glue::KEY_COMPUTER => Keyboard::Computer, + glue::KEY_CONFIG => Keyboard::Config, + glue::KEY_CONNECT => Keyboard::Connect, + glue::KEY_CONTEXT_MENU => Keyboard::ContextMenu, + glue::KEY_CONTROLPANEL => Keyboard::Controlpanel, + glue::KEY_COPY => Keyboard::Copy, + glue::KEY_CUT => Keyboard::Cut, + glue::KEY_CYCLEWINDOWS => Keyboard::CycleWindows, + glue::KEY_D => Keyboard::D, + glue::KEY_DASHBOARD => Keyboard::Dashboard, + glue::KEY_DATA => Keyboard::Data, + glue::KEY_DATABASE => Keyboard::Database, + glue::KEY_DEL_EOL => Keyboard::DelEol, + glue::KEY_DEL_EOS => Keyboard::DelEos, + glue::KEY_DEL_LINE => Keyboard::DelLine, + glue::KEY_DELETE => Keyboard::Delete, + glue::KEY_DELETEFILE => Keyboard::DeleteFile, + glue::KEY_DIGITS => Keyboard::Digits, + glue::KEY_DIRECTORY => Keyboard::Directory, + glue::KEY_DISPLAY_OFF => Keyboard::DisplayOff, + glue::KEY_DOCUMENTS => Keyboard::Documents, + glue::KEY_DOLLAR => Keyboard::Dollar, + glue::KEY_DOT => Keyboard::Dot, + glue::KEY_DOWN => Keyboard::Down, + glue::KEY_DVD => Keyboard::Dvd, + glue::KEY_E => Keyboard::E, + glue::KEY_EDIT => Keyboard::Edit, + glue::KEY_EDITOR => Keyboard::Editor, + glue::KEY_EJECTCD => Keyboard::EjectCd, + glue::KEY_EJECTCLOSECD => Keyboard::EjectCloseCd, + glue::KEY_EMAIL => Keyboard::Email, + glue::KEY_END => Keyboard::End, + glue::KEY_ENTER => Keyboard::Enter, + glue::KEY_EPG => Keyboard::Epg, + glue::KEY_EQUAL => Keyboard::Equal, + glue::KEY_ESC => Keyboard::Esc, + glue::KEY_EURO => Keyboard::Euro, + glue::KEY_EXIT => Keyboard::Exit, + glue::KEY_F => Keyboard::F, + glue::KEY_F1 => Keyboard::F1, + glue::KEY_F10 => Keyboard::F10, + glue::KEY_F11 => Keyboard::F11, + glue::KEY_F12 => Keyboard::F12, + glue::KEY_F13 => Keyboard::F13, + glue::KEY_F14 => Keyboard::F14, + glue::KEY_F15 => Keyboard::F15, + glue::KEY_F16 => Keyboard::F16, + glue::KEY_F17 => Keyboard::F17, + glue::KEY_F18 => Keyboard::F18, + glue::KEY_F19 => Keyboard::F19, + glue::KEY_F2 => Keyboard::F2, + glue::KEY_F20 => Keyboard::F20, + glue::KEY_F21 => Keyboard::F21, + glue::KEY_F22 => Keyboard::F22, + glue::KEY_F23 => Keyboard::F23, + glue::KEY_F24 => Keyboard::F24, + glue::KEY_F3 => Keyboard::F3, + glue::KEY_F4 => Keyboard::F4, + glue::KEY_F5 => Keyboard::F5, + glue::KEY_F6 => Keyboard::F6, + glue::KEY_F7 => Keyboard::F7, + glue::KEY_F8 => Keyboard::F8, + glue::KEY_F9 => Keyboard::F9, + glue::KEY_FASTFORWARD => Keyboard::FastForward, + glue::KEY_FASTREVERSE => Keyboard::FastReverse, + glue::KEY_FAVORITES => Keyboard::Favorites, + glue::KEY_FILE => Keyboard::File, + glue::KEY_FINANCE => Keyboard::Finance, + glue::KEY_FIND => Keyboard::Find, + glue::KEY_FIRST => Keyboard::First, + glue::KEY_FN => Keyboard::Fn, + glue::KEY_FN_1 => Keyboard::Fn1, + glue::KEY_FN_2 => Keyboard::Fn2, + glue::KEY_FN_B => Keyboard::FnB, + glue::KEY_FN_D => Keyboard::FnD, + glue::KEY_FN_E => Keyboard::FnE, + glue::KEY_FN_ESC => Keyboard::FnEsc, + glue::KEY_FN_F => Keyboard::FnF, + glue::KEY_FN_F1 => Keyboard::FnF1, + glue::KEY_FN_F10 => Keyboard::FnF10, + glue::KEY_FN_F11 => Keyboard::FnF11, + glue::KEY_FN_F12 => Keyboard::FnF12, + glue::KEY_FN_F2 => Keyboard::FnF2, + glue::KEY_FN_F3 => Keyboard::FnF3, + glue::KEY_FN_F4 => Keyboard::FnF4, + glue::KEY_FN_F5 => Keyboard::FnF5, + glue::KEY_FN_F6 => Keyboard::FnF6, + glue::KEY_FN_F7 => Keyboard::FnF7, + glue::KEY_FN_F8 => Keyboard::FnF8, + glue::KEY_FN_F9 => Keyboard::FnF9, + glue::KEY_FN_S => Keyboard::FnS, + glue::KEY_FORWARD => Keyboard::Forward, + glue::KEY_FORWARDMAIL => Keyboard::ForwardMail, + glue::KEY_FRAMEBACK => Keyboard::Frameback, + glue::KEY_FRAMEFORWARD => Keyboard::FrameForward, + glue::KEY_FRONT => Keyboard::Front, + glue::KEY_FULL_SCREEN => Keyboard::FullScreen, + glue::KEY_G => Keyboard::G, + glue::KEY_GAMES => Keyboard::Games, + glue::KEY_GOTO => Keyboard::Goto, + glue::KEY_GRAPHICSEDITOR => Keyboard::GraphicsEditor, + glue::KEY_GRAVE => Keyboard::Grave, + glue::KEY_GREEN => Keyboard::Green, + glue::KEY_H => Keyboard::H, + glue::KEY_HANGEUL => Keyboard::Hangeul, + glue::KEY_HANJA => Keyboard::Hanja, + glue::KEY_HELP => Keyboard::Help, + glue::KEY_HENKAN => Keyboard::Henkan, + glue::KEY_HIRAGANA => Keyboard::Hiragana, + glue::KEY_HOME => Keyboard::Home, + glue::KEY_HOMEPAGE => Keyboard::Homepage, + glue::KEY_HP => Keyboard::Hp, + glue::KEY_I => Keyboard::I, + glue::KEY_IMAGES => Keyboard::Images, + glue::KEY_INFO => Keyboard::Info, + glue::KEY_INS_LINE => Keyboard::InsLine, + glue::KEY_INSERT => Keyboard::Insert, + glue::KEY_ISO => Keyboard::Iso, + glue::KEY_J => Keyboard::J, + glue::KEY_JOURNAL => Keyboard::Journal, + glue::KEY_K => Keyboard::K, + glue::KEY_KATAKANA => Keyboard::Katakana, + glue::KEY_KATAKANAHIRAGANA => Keyboard::KatakanaHiragana, + glue::KEY_KBD_LAYOUT_NEXT => Keyboard::KbdLayoutNext, + glue::KEY_KBD_LCD_MENU1 => Keyboard::KbdLcdMenu1, + glue::KEY_KBD_LCD_MENU2 => Keyboard::KbdLcdMenu2, + glue::KEY_KBD_LCD_MENU3 => Keyboard::KbdLcdMenu3, + glue::KEY_KBD_LCD_MENU4 => Keyboard::KbdLcdMenu4, + glue::KEY_KBD_LCD_MENU5 => Keyboard::KbdLcdMenu5, + glue::KEY_KBDILLUMDOWN => Keyboard::KbdIllumDown, + glue::KEY_KBDILLUMTOGGLE => Keyboard::KbdIllumToggle, + glue::KEY_KBDILLUMUP => Keyboard::KbdIllumUp, + glue::KEY_KBDINPUTASSIST_ACCEPT => Keyboard::KbdInputAssistAccept, + glue::KEY_KBDINPUTASSIST_CANCEL => Keyboard::KbdInputAssistCancel, + glue::KEY_KBDINPUTASSIST_NEXT => Keyboard::KbdInputAssistNext, + glue::KEY_KBDINPUTASSIST_NEXTGROUP => Keyboard::KbdInputAssistNextgroup, + glue::KEY_KBDINPUTASSIST_PREV => Keyboard::KbdInputAssistPrev, + glue::KEY_KBDINPUTASSIST_PREVGROUP => Keyboard::KbdInputAssistPrevgroup, + glue::KEY_KEYBOARD => Keyboard::Keyboard, + glue::KEY_KP0 => Keyboard::Kp0, + glue::KEY_KP1 => Keyboard::Kp1, + glue::KEY_KP2 => Keyboard::Kp2, + glue::KEY_KP3 => Keyboard::Kp3, + glue::KEY_KP4 => Keyboard::Kp4, + glue::KEY_KP5 => Keyboard::Kp5, + glue::KEY_KP6 => Keyboard::Kp6, + glue::KEY_KP7 => Keyboard::Kp7, + glue::KEY_KP8 => Keyboard::Kp8, + glue::KEY_KP9 => Keyboard::Kp9, + glue::KEY_KPASTERISK => Keyboard::KpAsterisk, + glue::KEY_KPCOMMA => Keyboard::KpComma, + glue::KEY_KPDOT => Keyboard::KpDot, + glue::KEY_KPENTER => Keyboard::KpEnter, + glue::KEY_KPEQUAL => Keyboard::KpEqual, + glue::KEY_KPJPCOMMA => Keyboard::KpJpComma, + glue::KEY_KPLEFTPAREN => Keyboard::KpLeftParen, + glue::KEY_KPMINUS => Keyboard::KpMinus, + glue::KEY_KPPLUS => Keyboard::KpPlus, + glue::KEY_KPPLUSMINUS => Keyboard::KpPlusMinus, + glue::KEY_KPRIGHTPAREN => Keyboard::KpRightParen, + glue::KEY_KPSLASH => Keyboard::KpSlash, + glue::KEY_L => Keyboard::L, + glue::KEY_LANGUAGE => Keyboard::Language, + glue::KEY_LAST => Keyboard::Last, + glue::KEY_LEFT => Keyboard::Left, + glue::KEY_LEFT_DOWN => Keyboard::LeftDown, + glue::KEY_LEFT_UP => Keyboard::LeftUp, + glue::KEY_LEFTALT => Keyboard::LeftAlt, + glue::KEY_LEFTBRACE => Keyboard::LeftBrace, + glue::KEY_LEFTCTRL => Keyboard::LeftCtrl, + glue::KEY_LEFTMETA => Keyboard::LeftMeta, + glue::KEY_LEFTSHIFT => Keyboard::LeftShift, + glue::KEY_LIGHTS_TOGGLE => Keyboard::LightsToggle, + glue::KEY_LINEFEED => Keyboard::LineFeed, + glue::KEY_LIST => Keyboard::List, + glue::KEY_LOGOFF => Keyboard::LogOff, + glue::KEY_M => Keyboard::M, + glue::KEY_MACRO => Keyboard::Macro, + glue::KEY_MACRO1 => Keyboard::Macro1, + glue::KEY_MACRO10 => Keyboard::Macro10, + glue::KEY_MACRO11 => Keyboard::Macro11, + glue::KEY_MACRO12 => Keyboard::Macro12, + glue::KEY_MACRO13 => Keyboard::Macro13, + glue::KEY_MACRO14 => Keyboard::Macro14, + glue::KEY_MACRO15 => Keyboard::Macro15, + glue::KEY_MACRO16 => Keyboard::Macro16, + glue::KEY_MACRO17 => Keyboard::Macro17, + glue::KEY_MACRO18 => Keyboard::Macro18, + glue::KEY_MACRO19 => Keyboard::Macro19, + glue::KEY_MACRO2 => Keyboard::Macro2, + glue::KEY_MACRO20 => Keyboard::Macro20, + glue::KEY_MACRO21 => Keyboard::Macro21, + glue::KEY_MACRO22 => Keyboard::Macro22, + glue::KEY_MACRO23 => Keyboard::Macro23, + glue::KEY_MACRO24 => Keyboard::Macro24, + glue::KEY_MACRO25 => Keyboard::Macro25, + glue::KEY_MACRO26 => Keyboard::Macro26, + glue::KEY_MACRO27 => Keyboard::Macro27, + glue::KEY_MACRO28 => Keyboard::Macro28, + glue::KEY_MACRO29 => Keyboard::Macro29, + glue::KEY_MACRO3 => Keyboard::Macro3, + glue::KEY_MACRO30 => Keyboard::Macro30, + glue::KEY_MACRO4 => Keyboard::Macro4, + glue::KEY_MACRO5 => Keyboard::Macro5, + glue::KEY_MACRO6 => Keyboard::Macro6, + glue::KEY_MACRO7 => Keyboard::Macro7, + glue::KEY_MACRO8 => Keyboard::Macro8, + glue::KEY_MACRO9 => Keyboard::Macro9, + glue::KEY_MACRO_PRESET1 => Keyboard::MacroPreset1, + glue::KEY_MACRO_PRESET2 => Keyboard::MacroPreset2, + glue::KEY_MACRO_PRESET3 => Keyboard::MacroPreset3, + glue::KEY_MACRO_PRESET_CYCLE => Keyboard::MacroPresetCycle, + glue::KEY_MACRO_RECORD_START => Keyboard::MacroRecordStart, + glue::KEY_MACRO_RECORD_STOP => Keyboard::MacroRecordStop, + glue::KEY_MAIL => Keyboard::Mail, + glue::KEY_MEDIA => Keyboard::Media, + glue::KEY_MEDIA_REPEAT => Keyboard::MediaRepeat, + glue::KEY_MEDIA_TOP_MENU => Keyboard::MediaTopMenu, + glue::KEY_MEMO => Keyboard::Memo, + glue::KEY_MENU => Keyboard::Menu, + glue::KEY_MESSENGER => Keyboard::Messenger, + glue::KEY_MHP => Keyboard::Mhp, + glue::KEY_MICMUTE => Keyboard::MicMute, + glue::KEY_MINUS => Keyboard::Minus, + glue::KEY_MODE => Keyboard::Mode, + glue::KEY_MOVE => Keyboard::Move, + glue::KEY_MP3 => Keyboard::Mp3, + glue::KEY_MSDOS => Keyboard::MsDos, + glue::KEY_MUHENKAN => Keyboard::Muhenkan, + glue::KEY_MUTE => Keyboard::Mute, + glue::KEY_N => Keyboard::N, + glue::KEY_0 => Keyboard::N0, + glue::KEY_1 => Keyboard::N1, + glue::KEY_102ND => Keyboard::N102nd, + glue::KEY_10CHANNELSDOWN => Keyboard::N10ChannelsDown, + glue::KEY_10CHANNELSUP => Keyboard::N10ChannelsUp, + glue::KEY_2 => Keyboard::N2, + glue::KEY_3 => Keyboard::N3, + glue::KEY_3D_MODE => Keyboard::N3dMode, + glue::KEY_4 => Keyboard::N4, + glue::KEY_5 => Keyboard::N5, + glue::KEY_6 => Keyboard::N6, + glue::KEY_7 => Keyboard::N7, + glue::KEY_8 => Keyboard::N8, + glue::KEY_9 => Keyboard::N9, + glue::KEY_NEW => Keyboard::New, + glue::KEY_NEWS => Keyboard::News, + glue::KEY_NEXT => Keyboard::Next, + glue::KEY_NEXT_FAVORITE => Keyboard::NextFavorite, + glue::KEY_NEXTSONG => Keyboard::NextSong, + glue::KEY_NUMERIC_0 => Keyboard::Numeric0, + glue::KEY_NUMERIC_1 => Keyboard::Numeric1, + glue::KEY_NUMERIC_11 => Keyboard::Numeric11, + glue::KEY_NUMERIC_12 => Keyboard::Numeric12, + glue::KEY_NUMERIC_2 => Keyboard::Numeric2, + glue::KEY_NUMERIC_3 => Keyboard::Numeric3, + glue::KEY_NUMERIC_4 => Keyboard::Numeric4, + glue::KEY_NUMERIC_5 => Keyboard::Numeric5, + glue::KEY_NUMERIC_6 => Keyboard::Numeric6, + glue::KEY_NUMERIC_7 => Keyboard::Numeric7, + glue::KEY_NUMERIC_8 => Keyboard::Numeric8, + glue::KEY_NUMERIC_9 => Keyboard::Numeric9, + glue::KEY_NUMERIC_A => Keyboard::NumericA, + glue::KEY_NUMERIC_B => Keyboard::NumericB, + glue::KEY_NUMERIC_C => Keyboard::NumericC, + glue::KEY_NUMERIC_D => Keyboard::NumericD, + glue::KEY_NUMERIC_POUND => Keyboard::NumericPound, + glue::KEY_NUMERIC_STAR => Keyboard::NumericStar, + glue::KEY_NUMLOCK => Keyboard::NumLock, + glue::KEY_O => Keyboard::O, + glue::KEY_OK => Keyboard::Ok, + glue::KEY_ONSCREEN_KEYBOARD => Keyboard::OnscreenKeyboard, + glue::KEY_OPEN => Keyboard::Open, + glue::KEY_OPTION => Keyboard::Option, + glue::KEY_P => Keyboard::P, + glue::KEY_PAGEDOWN => Keyboard::PageDown, + glue::KEY_PAGEUP => Keyboard::PageUp, + glue::KEY_PASTE => Keyboard::Paste, + glue::KEY_PAUSE => Keyboard::Pause, + glue::KEY_PAUSE_RECORD => Keyboard::PauseRecord, + glue::KEY_PAUSECD => Keyboard::PauseCd, + glue::KEY_PC => Keyboard::Pc, + glue::KEY_PHONE => Keyboard::Phone, + glue::KEY_PLAY => Keyboard::Play, + glue::KEY_PLAYCD => Keyboard::PlayCd, + glue::KEY_PLAYER => Keyboard::Player, + glue::KEY_PLAYPAUSE => Keyboard::PlayPause, + glue::KEY_POWER => Keyboard::Power, + glue::KEY_POWER2 => Keyboard::Power2, + glue::KEY_PRESENTATION => Keyboard::Presentation, + glue::KEY_PREVIOUS => Keyboard::Previous, + glue::KEY_PREVIOUSSONG => Keyboard::PreviousSong, + glue::KEY_PRINT => Keyboard::Print, + glue::KEY_PRIVACY_SCREEN_TOGGLE => Keyboard::PrivacyScreenToggle, + glue::KEY_PROG1 => Keyboard::Prog1, + glue::KEY_PROG2 => Keyboard::Prog2, + glue::KEY_PROG3 => Keyboard::Prog3, + glue::KEY_PROG4 => Keyboard::Prog4, + glue::KEY_PROGRAM => Keyboard::Program, + glue::KEY_PROPS => Keyboard::Props, + glue::KEY_PVR => Keyboard::Pvr, + glue::KEY_Q => Keyboard::Q, + glue::KEY_QUESTION => Keyboard::Question, + glue::KEY_R => Keyboard::R, + glue::KEY_RADIO => Keyboard::Radio, + glue::KEY_RECORD => Keyboard::Record, + glue::KEY_RED => Keyboard::Red, + glue::KEY_REDO => Keyboard::Redo, + glue::KEY_REFRESH => Keyboard::Refresh, + glue::KEY_REPLY => Keyboard::Reply, + glue::KEY_RESERVED => Keyboard::Reserved, + glue::KEY_RESTART => Keyboard::Restart, + glue::KEY_REWIND => Keyboard::Rewind, + glue::KEY_RFKILL => Keyboard::RfKill, + glue::KEY_RIGHT => Keyboard::Right, + glue::KEY_RIGHT_DOWN => Keyboard::RightDown, + glue::KEY_RIGHT_UP => Keyboard::RightUp, + glue::KEY_RIGHTALT => Keyboard::RightAlt, + glue::KEY_RIGHTBRACE => Keyboard::RightBrace, + glue::KEY_RIGHTCTRL => Keyboard::RightCtrl, + glue::KEY_RIGHTMETA => Keyboard::RightMeta, + glue::KEY_RIGHTSHIFT => Keyboard::RightShift, + glue::KEY_RO => Keyboard::Ro, + glue::KEY_ROOT_MENU => Keyboard::RootMenu, + glue::KEY_ROTATE_DISPLAY => Keyboard::RotateDisplay, + glue::KEY_ROTATE_LOCK_TOGGLE => Keyboard::RotateLockToggle, + glue::KEY_S => Keyboard::S, + glue::KEY_SAT => Keyboard::Sat, + glue::KEY_SAT2 => Keyboard::Sat2, + glue::KEY_SAVE => Keyboard::Save, + glue::KEY_SCALE => Keyboard::Scale, + glue::KEY_SCREENSAVER => Keyboard::Screensaver, + glue::KEY_SCROLLDOWN => Keyboard::ScrollDown, + glue::KEY_SCROLLLOCK => Keyboard::ScrollLock, + glue::KEY_SCROLLUP => Keyboard::ScrollUp, + glue::KEY_SEARCH => Keyboard::Search, + glue::KEY_SELECT => Keyboard::Select, + glue::KEY_SELECTIVE_SCREENSHOT => Keyboard::SelectiveScreenshot, + glue::KEY_SEMICOLON => Keyboard::Semicolon, + glue::KEY_SEND => Keyboard::Send, + glue::KEY_SENDFILE => Keyboard::SendFile, + glue::KEY_SETUP => Keyboard::Setup, + glue::KEY_SHOP => Keyboard::Shop, + glue::KEY_SHUFFLE => Keyboard::Shuffle, + glue::KEY_SLASH => Keyboard::Slash, + glue::KEY_SLEEP => Keyboard::Sleep, + glue::KEY_SLOW => Keyboard::Slow, + glue::KEY_SLOWREVERSE => Keyboard::SlowReverse, + glue::KEY_SOUND => Keyboard::Sound, + glue::KEY_SPACE => Keyboard::Space, + glue::KEY_SPELLCHECK => Keyboard::Spellcheck, + glue::KEY_SPORT => Keyboard::Sport, + glue::KEY_SPREADSHEET => Keyboard::Spreadsheet, + glue::KEY_STOP => Keyboard::Stop, + glue::KEY_STOP_RECORD => Keyboard::StopRecord, + glue::KEY_STOPCD => Keyboard::StopCd, + glue::KEY_SUBTITLE => Keyboard::Subtitle, + glue::KEY_SUSPEND => Keyboard::Suspend, + glue::KEY_SWITCHVIDEOMODE => Keyboard::SwitchVideoMode, + glue::KEY_SYSRQ => Keyboard::SysRq, + glue::KEY_T => Keyboard::T, + glue::KEY_TAB => Keyboard::Tab, + glue::KEY_TAPE => Keyboard::Tape, + glue::KEY_TASKMANAGER => Keyboard::TaskManager, + glue::KEY_TEEN => Keyboard::Teen, + glue::KEY_TEXT => Keyboard::Text, + glue::KEY_TIME => Keyboard::Time, + glue::KEY_TITLE => Keyboard::Title, + glue::KEY_TOUCHPAD_OFF => Keyboard::TouchpadOff, + glue::KEY_TOUCHPAD_ON => Keyboard::TouchpadOn, + glue::KEY_TOUCHPAD_TOGGLE => Keyboard::TouchpadToggle, + glue::KEY_TUNER => Keyboard::Tuner, + glue::KEY_TV => Keyboard::Tv, + glue::KEY_TV2 => Keyboard::Tv2, + glue::KEY_TWEN => Keyboard::Twen, + glue::KEY_U => Keyboard::U, + glue::KEY_UNDO => Keyboard::Undo, + glue::KEY_UNKNOWN => Keyboard::Unknown, + glue::KEY_UNMUTE => Keyboard::Unmute, + glue::KEY_UP => Keyboard::Up, + glue::KEY_UWB => Keyboard::Uwb, + glue::KEY_V => Keyboard::V, + glue::KEY_VCR => Keyboard::Vcr, + glue::KEY_VCR2 => Keyboard::Vcr2, + glue::KEY_VENDOR => Keyboard::Vendor, + glue::KEY_VIDEO => Keyboard::Video, + glue::KEY_VIDEO_NEXT => Keyboard::VideoNext, + glue::KEY_VIDEO_PREV => Keyboard::VideoPrev, + glue::KEY_VIDEOPHONE => Keyboard::VideoPhone, + glue::KEY_VOD => Keyboard::Vod, + glue::KEY_VOICECOMMAND => Keyboard::VoiceCommand, + glue::KEY_VOICEMAIL => Keyboard::VoiceMail, + glue::KEY_VOLUMEDOWN => Keyboard::VolumeDown, + glue::KEY_VOLUMEUP => Keyboard::VolumeUp, + glue::KEY_W => Keyboard::W, + glue::KEY_WAKEUP => Keyboard::WakeUp, + glue::KEY_WLAN => Keyboard::Wlan, + glue::KEY_WORDPROCESSOR => Keyboard::WordProcessor, + glue::KEY_WPS_BUTTON => Keyboard::WpsButton, + glue::KEY_WWAN => Keyboard::Wwan, + glue::KEY_WWW => Keyboard::Www, + glue::KEY_X => Keyboard::X, + glue::KEY_XFER => Keyboard::Xfer, + glue::KEY_Y => Keyboard::Y, + glue::KEY_YELLOW => Keyboard::Yellow, + glue::KEY_YEN => Keyboard::Yen, + glue::KEY_Z => Keyboard::Z, + glue::KEY_ZENKAKUHANKAKU => Keyboard::ZenkakuHankaku, + glue::KEY_ZOOMIN => Keyboard::ZoomIn, + glue::KEY_ZOOMOUT => Keyboard::ZoomOut, + glue::KEY_ZOOMRESET => Keyboard::ZoomReset, _ => return None, }; - Some(key) + Some(keyboard) } } diff --git a/rkvm-input/src/lib.rs b/rkvm-input/src/lib.rs index eea0980..bed81ab 100644 --- a/rkvm-input/src/lib.rs +++ b/rkvm-input/src/lib.rs @@ -7,6 +7,7 @@ pub mod rel; pub mod sync; pub mod writer; +mod convert; mod evdev; mod glue; mod registry; diff --git a/rkvm-input/src/rel.rs b/rkvm-input/src/rel.rs index c2831c3..a9bc32a 100644 --- a/rkvm-input/src/rel.rs +++ b/rkvm-input/src/rel.rs @@ -1,3 +1,4 @@ +use crate::convert::Convert; use crate::glue; use serde::{Deserialize, Serialize}; @@ -24,8 +25,10 @@ pub enum RelAxis { HWheelHiRes, } -impl RelAxis { - pub(crate) fn from_raw(code: u16) -> Option { +impl Convert for RelAxis { + type Raw = u16; + + fn from_raw(code: Self::Raw) -> Option { let axis = match code as _ { glue::REL_X => Self::X, glue::REL_Y => Self::Y, @@ -45,7 +48,7 @@ impl RelAxis { Some(axis) } - pub(crate) fn to_raw(&self) -> u16 { + fn to_raw(&self) -> Option { let code = match self { Self::X => glue::REL_X, Self::Y => glue::REL_Y, @@ -61,6 +64,6 @@ impl RelAxis { Self::HWheelHiRes => glue::REL_HWHEEL_HI_RES, }; - code as _ + Some(code as _) } } diff --git a/rkvm-input/src/sync.rs b/rkvm-input/src/sync.rs index 5477852..3e63ffe 100644 --- a/rkvm-input/src/sync.rs +++ b/rkvm-input/src/sync.rs @@ -1,3 +1,4 @@ +use crate::convert::Convert; use crate::glue; use serde::{Deserialize, Serialize}; @@ -8,13 +9,25 @@ pub enum SyncEvent { Mt, } -impl SyncEvent { - pub(crate) fn to_raw(&self) -> u16 { - let code = match self { +impl Convert for SyncEvent { + type Raw = u16; + + fn to_raw(&self) -> Option { + let raw = match self { Self::All => glue::SYN_REPORT, Self::Mt => glue::SYN_MT_REPORT, }; - code as _ + Some(raw as _) + } + + fn from_raw(raw: Self::Raw) -> Option { + let event = match raw as _ { + glue::SYN_REPORT => SyncEvent::All, + glue::SYN_MT_REPORT => SyncEvent::Mt, + _ => return None, + }; + + Some(event) } } diff --git a/rkvm-input/src/writer.rs b/rkvm-input/src/writer.rs index bb5880a..3322d8d 100644 --- a/rkvm-input/src/writer.rs +++ b/rkvm-input/src/writer.rs @@ -1,4 +1,5 @@ use crate::abs::{AbsAxis, AbsEvent, AbsInfo}; +use crate::convert::Convert; use crate::evdev::Evdev; use crate::event::Event; use crate::glue::{self, input_absinfo}; @@ -25,20 +26,20 @@ impl Writer { pub async fn write(&mut self, event: &Event) -> Result<(), Error> { let (r#type, code, value) = match event { - Event::Rel(RelEvent { axis, value }) => (glue::EV_REL, Some(axis.to_raw()), *value), + Event::Rel(RelEvent { axis, value }) => (glue::EV_REL, axis.to_raw(), Some(*value)), Event::Abs(event) => match event { - AbsEvent::Axis { axis, value } => (glue::EV_ABS, axis.to_raw(), *value), + AbsEvent::Axis { axis, value } => (glue::EV_ABS, axis.to_raw(), Some(*value)), AbsEvent::MtToolType { value } => ( glue::EV_ABS, Some(glue::ABS_MT_TOOL_TYPE as _), value.to_raw(), ), }, - Event::Key(KeyEvent { down, key }) => (glue::EV_KEY, Some(key.to_raw()), *down as _), - Event::Sync(event) => (glue::EV_SYN, Some(event.to_raw()), 0), + Event::Key(KeyEvent { down, key }) => (glue::EV_KEY, key.to_raw(), Some(*down as _)), + Event::Sync(event) => (glue::EV_SYN, event.to_raw(), Some(0)), }; - if let Some(code) = code { + if let (Some(code), Some(value)) = (code, value) { self.write_raw(r#type as _, code, value).await?; } @@ -150,11 +151,16 @@ impl WriterBuilder { pub fn rel>(self, items: T) -> Result { for axis in items { + let axis = match axis.to_raw() { + Some(axis) => axis, + None => continue, + }; + let ret = unsafe { glue::libevdev_enable_event_code( self.evdev.as_ptr(), glue::EV_REL, - axis.to_raw() as _, + axis as _, ptr::null(), ) }; @@ -215,11 +221,16 @@ impl WriterBuilder { pub fn key>(self, items: T) -> Result { for key in items { + let key = match key.to_raw() { + Some(key) => key, + None => continue, + }; + let ret = unsafe { glue::libevdev_enable_event_code( self.evdev.as_ptr(), glue::EV_KEY, - key.to_raw() as _, + key as _, ptr::null(), ) }; diff --git a/rkvm-net/src/version.rs b/rkvm-net/src/version.rs index 04c8893..a3de6f9 100644 --- a/rkvm-net/src/version.rs +++ b/rkvm-net/src/version.rs @@ -8,7 +8,7 @@ use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; pub struct Version(u16); impl Version { - pub const CURRENT: Self = Self(3); + pub const CURRENT: Self = Self(4); } impl Display for Version { diff --git a/rkvm-server/src/config.rs b/rkvm-server/src/config.rs index d630ec6..ffc19cd 100644 --- a/rkvm-server/src/config.rs +++ b/rkvm-server/src/config.rs @@ -51,7 +51,6 @@ pub enum SwitchKey { BrightnessMax, BrightnessMin, BrightnessToggle, - BrightnessZero, BrightnessDown, BrightnessUp, BrlDot1, @@ -107,7 +106,6 @@ pub enum SwitchKey { Delete, DeleteFile, Digits, - Direction, Directory, DisplayOff, DisplayToggle, @@ -322,19 +320,33 @@ pub enum SwitchKey { Muhenkan, Mute, N, + #[serde(rename = "0")] N0, + #[serde(rename = "1")] N1, + #[serde(rename = "102nd")] N102nd, + #[serde(rename = "10-channels-down")] N10ChannelsDown, + #[serde(rename = "10-channels-up")] N10ChannelsUp, + #[serde(rename = "2")] N2, + #[serde(rename = "3")] N3, + #[serde(rename = "3d-mode")] N3dMode, + #[serde(rename = "4")] N4, + #[serde(rename = "5")] N5, + #[serde(rename = "6")] N6, + #[serde(rename = "7")] N7, + #[serde(rename = "8")] N8, + #[serde(rename = "9")] N9, New, News, @@ -422,8 +434,6 @@ pub enum SwitchKey { Sat2, Save, Scale, - Screen, - Screenlock, Screensaver, ScrollDown, ScrollLock, @@ -489,7 +499,6 @@ pub enum SwitchKey { VolumeUp, W, WakeUp, - Wimax, Wlan, WordProcessor, WpsButton, @@ -502,7 +511,6 @@ pub enum SwitchKey { Yen, Z, ZenkakuHankaku, - Zoom, ZoomIn, ZoomOut, ZoomReset, @@ -621,7 +629,6 @@ pub enum SwitchKey { impl Into for SwitchKey { fn into(self) -> Key { match self { - // Keys. // Keys. Self::A => Key::Key(Keyboard::A), Self::Ab => Key::Key(Keyboard::Ab), @@ -656,7 +663,6 @@ impl Into for SwitchKey { Self::BrightnessMax => Key::Key(Keyboard::BrightnessMax), Self::BrightnessMin => Key::Key(Keyboard::BrightnessMin), Self::BrightnessToggle => Key::Key(Keyboard::BrightnessToggle), - Self::BrightnessZero => Key::Key(Keyboard::BrightnessZero), Self::BrightnessDown => Key::Key(Keyboard::BrightnessDown), Self::BrightnessUp => Key::Key(Keyboard::BrightnessUp), Self::BrlDot1 => Key::Key(Keyboard::BrlDot1), @@ -712,7 +718,6 @@ impl Into for SwitchKey { Self::Delete => Key::Key(Keyboard::Delete), Self::DeleteFile => Key::Key(Keyboard::DeleteFile), Self::Digits => Key::Key(Keyboard::Digits), - Self::Direction => Key::Key(Keyboard::Direction), Self::Directory => Key::Key(Keyboard::Directory), Self::DisplayOff => Key::Key(Keyboard::DisplayOff), Self::DisplayToggle => Key::Key(Keyboard::DisplayToggle), @@ -847,7 +852,7 @@ impl Into for SwitchKey { Self::Kp9 => Key::Key(Keyboard::Kp9), Self::KpAsterisk => Key::Key(Keyboard::KpAsterisk), Self::KpComma => Key::Key(Keyboard::KpComma), - Self::KpDott => Key::Key(Keyboard::KpDott), + Self::KpDott => Key::Key(Keyboard::KpDot), Self::KpEnter => Key::Key(Keyboard::KpEnter), Self::KpEqual => Key::Key(Keyboard::KpEqual), Self::KpJpComma => Key::Key(Keyboard::KpJpComma), @@ -1027,8 +1032,6 @@ impl Into for SwitchKey { Self::Sat2 => Key::Key(Keyboard::Sat2), Self::Save => Key::Key(Keyboard::Save), Self::Scale => Key::Key(Keyboard::Scale), - Self::Screen => Key::Key(Keyboard::Screen), - Self::Screenlock => Key::Key(Keyboard::Screenlock), Self::Screensaver => Key::Key(Keyboard::Screensaver), Self::ScrollDown => Key::Key(Keyboard::ScrollDown), Self::ScrollLock => Key::Key(Keyboard::ScrollLock), @@ -1094,7 +1097,6 @@ impl Into for SwitchKey { Self::VolumeUp => Key::Key(Keyboard::VolumeUp), Self::W => Key::Key(Keyboard::W), Self::WakeUp => Key::Key(Keyboard::WakeUp), - Self::Wimax => Key::Key(Keyboard::Wimax), Self::Wlan => Key::Key(Keyboard::Wlan), Self::WordProcessor => Key::Key(Keyboard::WordProcessor), Self::WpsButton => Key::Key(Keyboard::WpsButton), @@ -1107,7 +1109,6 @@ impl Into for SwitchKey { Self::Yen => Key::Key(Keyboard::Yen), Self::Z => Key::Key(Keyboard::Z), Self::ZenkakuHankaku => Key::Key(Keyboard::ZenkakuHankaku), - Self::Zoom => Key::Key(Keyboard::Zoom), Self::ZoomIn => Key::Key(Keyboard::ZoomIn), Self::ZoomOut => Key::Key(Keyboard::ZoomOut), Self::ZoomReset => Key::Key(Keyboard::ZoomReset), diff --git a/switch-keys.md b/switch-keys.md index 001c374..4c8d84b 100644 --- a/switch-keys.md +++ b/switch-keys.md @@ -33,7 +33,6 @@ - `brightness-max` - `brightness-min` - `brightness-toggle` -- `brightness-zero` - `brightness-down` - `brightness-up` - `brl-dot1` @@ -89,7 +88,6 @@ - `delete` - `delete-file` - `digits` -- `direction` - `directory` - `display-off` - `display-toggle` @@ -304,20 +302,20 @@ - `muhenkan` - `mute` - `n` -- `n0` -- `n1` -- `n102nd` -- `n10-channels-down` -- `n10-channels-up` -- `n2` -- `n3` -- `n3d-mode` -- `n4` -- `n5` -- `n6` -- `n7` -- `n8` -- `n9` +- `0` +- `1` +- `102nd` +- `10-channels-down` +- `10-channels-up` +- `2` +- `3` +- `3d-mode` +- `4` +- `5` +- `6` +- `7` +- `8` +- `9` - `new` - `news` - `next` @@ -404,8 +402,6 @@ - `sat2` - `save` - `scale` -- `screen` -- `screenlock` - `screensaver` - `scroll-down` - `scroll-lock` @@ -471,7 +467,6 @@ - `volume-up` - `w` - `wake-up` -- `wimax` - `wlan` - `word-processor` - `wps-button` @@ -484,7 +479,6 @@ - `yen` - `z` - `zenkaku-hankaku` -- `zoom` - `zoom-in` - `zoom-out` - `zoom-reset`