sysfs_class/
backlight.rs

1use crate::{Brightness, SysClass};
2use std::io::Result;
3use std::path::{Path, PathBuf};
4
5/// Fetch and modify brightness values of backlight controls.
6#[derive(Clone)]
7pub struct Backlight {
8    path: PathBuf,
9}
10
11impl SysClass for Backlight {
12    fn class() -> &'static str {
13        "backlight"
14    }
15
16    unsafe fn from_path_unchecked(path: PathBuf) -> Self {
17        Self { path }
18    }
19
20    fn path(&self) -> &Path {
21        &self.path
22    }
23}
24
25impl Backlight {
26    method!(actual_brightness parse_file u64);
27
28    method!(bl_power parse_file u64);
29
30    method!("type", type_ trim_file String);
31}
32
33impl Brightness for Backlight {}