@@ -93,13 +93,17 @@ pub enum FpBrightnessArg {
9393 High ,
9494 Medium ,
9595 Low ,
96+ UltraLow ,
97+ Auto ,
9698}
9799impl From < FpBrightnessArg > for FpLedBrightnessLevel {
98100 fn from ( w : FpBrightnessArg ) -> FpLedBrightnessLevel {
99101 match w {
100102 FpBrightnessArg :: High => FpLedBrightnessLevel :: High ,
101103 FpBrightnessArg :: Medium => FpLedBrightnessLevel :: Medium ,
102104 FpBrightnessArg :: Low => FpLedBrightnessLevel :: Low ,
105+ FpBrightnessArg :: UltraLow => FpLedBrightnessLevel :: UltraLow ,
106+ FpBrightnessArg :: Auto => FpLedBrightnessLevel :: Auto ,
103107 }
104108 }
105109}
@@ -159,7 +163,8 @@ pub struct Cli {
159163 pub input_deck_mode : Option < InputDeckModeArg > ,
160164 pub charge_limit : Option < Option < u8 > > ,
161165 pub get_gpio : Option < String > ,
162- pub fp_brightness : Option < Option < FpBrightnessArg > > ,
166+ pub fp_led_level : Option < Option < FpBrightnessArg > > ,
167+ pub fp_brightness : Option < Option < u8 > > ,
163168 pub kblight : Option < Option < u8 > > ,
164169 pub tablet_mode : Option < TabletModeArg > ,
165170 pub console : Option < ConsoleArg > ,
@@ -741,6 +746,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
741746 } else {
742747 println ! ( "Not found" ) ;
743748 }
749+ } else if let Some ( maybe_led_level) = & args. fp_led_level {
750+ print_err ( handle_fp_led_level ( & ec, * maybe_led_level) ) ;
744751 } else if let Some ( maybe_brightness) = & args. fp_brightness {
745752 print_err ( handle_fp_brightness ( & ec, * maybe_brightness) ) ;
746753 } else if let Some ( Some ( kblight) ) = args. kblight {
@@ -1009,7 +1016,8 @@ Options:
10091016 --input-deck-mode Set input deck power mode [possible values: auto, off, on] (Framework 16 only)
10101017 --charge-limit [<VAL>] Get or set battery charge limit (Percentage number as arg, e.g. '100')
10111018 --get-gpio <GET_GPIO> Get GPIO value by name
1012- --fp-brightness [<VAL>]Get or set fingerprint LED brightness level [possible values: high, medium, low]
1019+ --fp-led-level [<VAL>] Get or set fingerprint LED brightness level [possible values: high, medium, low]
1020+ --fp-brightness [<VAL>]Get or set fingerprint LED brightness percentage
10131021 --kblight [<KBLIGHT>] Set keyboard backlight percentage or get, if no value provided
10141022 --console <CONSOLE> Get EC console, choose whether recent or to follow the output [possible values: recent, follow]
10151023 --hash <HASH> Hash a file of arbitrary data
@@ -1355,13 +1363,34 @@ fn handle_charge_limit(ec: &CrosEc, maybe_limit: Option<u8>) -> EcResult<()> {
13551363 Ok ( ( ) )
13561364}
13571365
1358- fn handle_fp_brightness ( ec : & CrosEc , maybe_brightness : Option < FpBrightnessArg > ) -> EcResult < ( ) > {
1366+ fn handle_fp_led_level ( ec : & CrosEc , maybe_led_level : Option < FpBrightnessArg > ) -> EcResult < ( ) > {
1367+ if let Some ( led_level) = maybe_led_level {
1368+ ec. set_fp_led_level ( led_level. into ( ) ) ?;
1369+ }
1370+
1371+ let ( brightness, level) = ec. get_fp_led_level ( ) ?;
1372+ // TODO: Rename to power button
1373+ println ! ( "Fingerprint LED Brightness" ) ;
1374+ if let Some ( level) = level {
1375+ println ! ( " Requested: {:?}" , level) ;
1376+ }
1377+ println ! ( " Brightness: {}%" , brightness) ;
1378+
1379+ Ok ( ( ) )
1380+ }
1381+
1382+ fn handle_fp_brightness ( ec : & CrosEc , maybe_brightness : Option < u8 > ) -> EcResult < ( ) > {
13591383 if let Some ( brightness) = maybe_brightness {
1360- ec. set_fp_led_level ( brightness. into ( ) ) ?;
1384+ ec. set_fp_led_percentage ( brightness) ?;
13611385 }
13621386
1363- let level = ec. get_fp_led_level ( ) ?;
1364- println ! ( "Fingerprint LED Brightness: {:?}%" , level) ;
1387+ let ( brightness, level) = ec. get_fp_led_level ( ) ?;
1388+ // TODO: Rename to power button
1389+ println ! ( "Fingerprint LED Brightness" ) ;
1390+ if let Some ( level) = level {
1391+ println ! ( " Requested: {:?}" , level) ;
1392+ }
1393+ println ! ( " Brightness: {}%" , brightness) ;
13651394
13661395 Ok ( ( ) )
13671396}
0 commit comments