summaryrefslogtreecommitdiff
path: root/src/lib.rs
Commit message (Collapse)AuthorAgeFilesLines
* bin: lib: address some clippy lintsPhilipp Gesang2021-12-221-3/+5
| | | | Mostly about match autoref / autoderef kicking in.
* lib: rework led flags as composite typePhilipp Gesang2021-12-221-30/+207
| | | | | | | | | Split the underlying led bits handling into KbLeds and employ this to construct both KbLedState and KbLedFlags, preserving their distinctness. This also finally implements the handling of the default states from the higher order bits of KD*KBLED.
* Revert "lib: implement “kb flags”"Philipp Gesang2021-12-221-61/+71
| | | | | | | This partially reverts commit 92f35f8e90199e4d9dfbcc545be456f4c2d7a1ce. The keyboard modifiers behave too differently from the LED state for the const generics to pay off.
* lib: implement “kb flags”Philipp Gesang2021-12-121-95/+61
| | | | | | | | A const-genericized version of the “kb leds” implementation. Does seem to consistently run into EINVAL no matter what flags we provide. Also incomplete as KDGKBLED / KDSKBLED pack more info into higher bits of their argument.
* lib: add ioctl wrappers for KDGKBLED / KDSKBLEDPhilipp Gesang2021-12-121-43/+111
| | | | | Reusing the same definitions as we have for KD{G,S}ETLED as they’re practically the same.
* lib: close console fd on dropPhilipp Gesang2021-12-121-0/+14
|
* bin: allow specifying the console on the command linePhilipp Gesang2021-12-121-1/+1
| | | | | | | | | | | | | As in: $ vtcol --console /dev/tty6 colors get solarized $ vtcol --console /dev/tty6 colors set phosphor $ vtcol --console /dev/tty6 colors get phosphor That simplifies testing so much I wonder why the heck I needed this long to finally implement it.
* bin: lib: implement setting state of individual LEDsPhilipp Gesang2021-12-121-1/+25
|
* bin: implement led revertPhilipp Gesang2021-12-121-0/+3
| | | | | | | | | | | | Command: $ vtcol leds set --revert Implementing this detail of KDSETLED: [I]f a higher order bit is set, the LEDs revert to normal: displaying the state of the keyboard functions of caps lock, num lock, and scroll lock.
* bin: implement “leds set” subcommandPhilipp Gesang2021-12-121-1/+27
| | | | | | | Currently only supports setting the raw state from an integer value: $ vtcol leds set -8 2
* add KDGETLED subcommand to vtcol-binPhilipp Gesang2021-12-081-1/+27
| | | | | | | | | Actually we add both subcommand and sub-subcommand. Example: [*] 15:52:40 phg@acheron vtcol $ vtcol leds get Caps: false, Num: true, Scroll: false
* add ioctl wrappers for KDGETLED / KDSETLEDPhilipp Gesang2021-12-081-5/+119
|
* move base64 handling out of PalettePhilipp Gesang2021-11-251-14/+19
| | | | | Try and not encumber the lower level types with more dependencies than needed.
* don’t panic!() on open(2) failurePhilipp Gesang2021-11-241-10/+10
|
* add base64 input for ‘set’Philipp Gesang2021-11-241-0/+31
|
* add base64 output for ‘get’Philipp Gesang2021-11-241-1/+5
|
* optionally clear after each fade stepPhilipp Gesang2021-11-231-3/+13
|
* implement fadingPhilipp Gesang2021-11-231-1/+98
| | | | vtcol fade --ms 1000 --frequency 10 --to solarized & dmesg
* get rid of useless lifetimesPhilipp Gesang2021-11-221-5/+5
|
* switch RawPalette to integer representationPhilipp Gesang2021-11-161-48/+93
| | | | | Introducing a simple type for RGB colors. That awkward string representation for RawPalette got unwieldy quick.
* add KDGKBTYPE wrapperPhilipp Gesang2021-11-151-8/+14
|
* namespace ioctl related symbolsPhilipp Gesang2021-11-151-45/+53
|
* move console handling into libPhilipp Gesang2021-11-151-5/+152
| | | | | All operations are now exposed through wrappers that are member functions of ``vtcol::Console``.
* use idiomatic syscall error wrappersPhilipp Gesang2021-11-151-24/+48
| | | | | A simplified version of the function used in std which aren’t made public.
* turn Fd into proper wrapperPhilipp Gesang2021-11-151-5/+25
|
* lib: split out libraryPhilipp Gesang2021-11-151-0/+528
Not really a satisfactorily clean split as of yet but it’s a start. Error types have been changed from anyhow to io::Error in ``lib.rs`` so as to not force an error handling crate on downstream users.