From 97609109918614c2adbac5779514eada551bfca9 Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 14 Jun 2022 01:23:48 +0800 Subject: [PATCH] do not renumber explicitly numbered enums In general, if an enum has been explicitly numbered, it means that there are crates that depend on the actual number assigned, and changing them will break other crates. This is done to allow for cross-compatibility reasons, for example, going to a C FFI or to the standard library, where we can't simply refer to a Rust crate to import the symbolic enums and have the compiler figure out a consistent numbering method. Thus even though it's a bit "ugly", please assign only unused numbers to new enums, and when old enums are retired, do not re-use the number. --- services/keyboard/src/api.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/services/keyboard/src/api.rs b/services/keyboard/src/api.rs index 37fa41a4e..087f3e058 100644 --- a/services/keyboard/src/api.rs +++ b/services/keyboard/src/api.rs @@ -61,28 +61,28 @@ pub(crate) enum Opcode { RegisterRawListener = 3, /// request for updates for *when* keyboard is pressed - RegisterKeyObserver = 4, + RegisterKeyObserver = 12, /// set repeat delay, rate; both in ms - SetRepeat = 5, //(u32, u32), + SetRepeat = 4, //(u32, u32), /// set chording interval (how long to wait for all keydowns to happen before interpreting as a chord), in ms (for braille keyboards) - SetChordInterval = 6, //(u32), + SetChordInterval = 5, //(u32), /// used by host mode emulation and debug UART to inject keys - InjectKey = 7, //(char), + InjectKey = 6, //(char), /// used by the interrupt handler to transfer results to the main loop - HandlerTrigger = 8, + HandlerTrigger = 7, /// used to turn keyboard vibrate on and off - Vibe = 9, + Vibe = 8, /// a blocking key listener - blocks until a key is hit - BlockingKeyListener = 10, + BlockingKeyListener = 9, /// Suspend/resume callback - SuspendResume = 11, + SuspendResume = 10, } // this structure is used to register a keyboard listener. Currently, we only accept