summaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index 0669b87..64cf6f3 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -186,7 +186,10 @@ impl KbLedState
}
#[inline]
- pub fn revert(con: &Console) -> io::Result<()> { ioctl::kdsetled(con, None) }
+ pub fn revert(con: &Console) -> io::Result<()>
+ {
+ ioctl::kdsetled(con, None)
+ }
#[inline]
pub fn cap(&self) -> bool { (self.0 & 0x4) != 0 }
@@ -196,6 +199,27 @@ impl KbLedState
#[inline]
pub fn scr(&self) -> bool { (self.0 & 0x1) != 0 }
+
+ #[inline]
+ pub fn set_cap(&mut self, set: bool)
+ {
+ let bit = (set as u8) << 2;
+ self.0 = (self.0 & !bit) | bit;
+ }
+
+ #[inline]
+ pub fn set_num(&mut self, set: bool)
+ {
+ let bit = (set as u8) << 1;
+ self.0 = (self.0 & !bit) | bit;
+ }
+
+ #[inline]
+ pub fn set_scr(&mut self, set: bool)
+ {
+ let bit = set as u8;
+ self.0 = (self.0 & !bit) | bit;
+ }
}
impl fmt::Display for KbLedState