meh_asus/debugfs/common_hardware/
camera_led.rs

1//! ASUS_WMI_DEVID_CAMERA_LED
2//! 
3//! Camera Button LED Key (F10 on most Asus Laptop)
4
5pub use super::led_state::LedState;
6use crate::debugfs::Hardware;
7
8pub const DEV_ID: u64 = 0x00060079;
9pub const fn get() -> Hardware<LedState> {
10    Hardware::new(DEV_ID)
11}
12
13#[test]
14fn camera_led() {
15    let camera_led = get();
16
17    let initial_state = camera_led
18        .read()
19        .expect("there should be a current state of camera led");
20
21    // turn on led
22    camera_led
23        .apply(LedState::On)
24        .expect("camera led should be turned on");
25    assert_eq!(camera_led.read().unwrap(), LedState::On);
26
27    // turn off led
28    camera_led
29        .apply(LedState::Off)
30        .expect("camera led should be turned off");
31    assert_eq!(camera_led.read().unwrap(), LedState::Off);
32
33    // return to initial state
34    camera_led
35        .apply(initial_state)
36        .expect("camera led should be switched to initial state");
37
38    assert_eq!(
39        camera_led.read().unwrap(),
40        initial_state,
41        "Failed to revert to initial state"
42    );
43}