From bb6e409e3a5f8d1b2d92eb7c5a3c4de73ea42985 Mon Sep 17 00:00:00 2001 From: Philipp Gesang Date: Wed, 22 Dec 2021 17:41:59 +0100 Subject: =?UTF-8?q?expand=20docs=20to=20cover=20=E2=80=9Ckb=20{leds,flags}?= =?UTF-8?q?=E2=80=9D=20split?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.rst | 12 ++++++++++-- doc/vtcol.rst | 25 +++++++++++++++++++++---- src/lib.rs | 4 ++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/README.rst b/README.rst index 79f7cac..2631ac8 100644 --- a/README.rst +++ b/README.rst @@ -79,12 +79,14 @@ This will print the color definitions contained in the scheme; if the specified name does not resolve to a pre-defined scheme it will be interpreted as a file name instead. -Keyboard LEDs +Keyboard LEDs and flags ------------------------------------------------------------------------------- +Keyboard handling is grouped under the ``vtcol kb`` subcommand. + Show the current state of the keyboard LEDs: :: - $ vtcol leds get + $ vtcol kb leds get caps: false, num: true, scroll: false Set the state of the Caps Lock LED (does *not* affect the Caps Lock state, just @@ -92,6 +94,12 @@ the LED itself): :: $ vtcol leds set --caps on +Likewise for the keyboad state (*not* the LEDs): :: + + $ vtcol kb flags get + [flags: caps: false, num: false, scroll: false; default: caps: false, num: false, scroll: false] + + Building ------------------------------------------------------------------------------- diff --git a/doc/vtcol.rst b/doc/vtcol.rst index e601fdd..7166c72 100644 --- a/doc/vtcol.rst +++ b/doc/vtcol.rst @@ -36,9 +36,9 @@ they operate on: Inspect and manipulate the console palette. -**leds** +**kb** - Keyboad LED state. + Keyboard manipulation (LEds, modifiers). vtcol colors commands ##################### @@ -100,8 +100,8 @@ vtcol colors commands $ vtcol colors fade --ms 1337 --from solarized --to solarized_light -vtcol leds commands -################### +vtcol kb leds commands +###################### **get** @@ -122,6 +122,23 @@ vtcol leds commands $ vtcol leds set --revert +vtcol kb flags commands +###################### + +**get** + + Get the current keyboard flags. Example: :: + + $ vtcol -C /dev/tty6 kb flags get + [flags: caps: false, num: false, scroll: false; default: caps: false, num: false, scroll: false] + +**set** + + Set the state of individual keyboard LEDs: :: + + $ vtcol flags set --caps on --num off + + global options ------------------------------------------------------------------------------- diff --git a/src/lib.rs b/src/lib.rs index 5cf62c1..374b518 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -194,6 +194,8 @@ pub mod ioctl .map(|_| ()) } + /* This should perhaps return unit as the kernel supposedly always returns + the constant ``KB_101``. */ pub fn kdgkbtype(fd: &F) -> Result { let mut kb: libc::c_char = 0; @@ -202,6 +204,8 @@ pub mod ioctl ioctl(fd.as_raw_fd(), KDGKBTYPE, &mut kb as *mut _) })?; + //assert_eq(kb, KB_101); /* XXX */ + Ok(kb) } } -- cgit v1.2.3