File tree Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Expand file tree Collapse file tree 6 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ pub enum EcCommands {
61
61
FlashNotified = 0x3E01 ,
62
62
/// Change charge limit
63
63
ChargeLimitControl = 0x3E03 ,
64
+ DisablePs2Emulation = 0x3E08 ,
64
65
/// Get/Set Fingerprint LED brightness
65
66
FpLedLevelControl = 0x3E0E ,
66
67
/// Get information about the current chassis open/close status
Original file line number Diff line number Diff line change @@ -1231,6 +1231,17 @@ impl EcRequest<EcResponseChargeLimitControl> for EcRequestChargeLimitControl {
1231
1231
/// TODO: Use this
1232
1232
pub const EC_CHARGE_LIMIT_RESTORE : u8 = 0x7F ;
1233
1233
1234
+ #[ repr( C , packed) ]
1235
+ pub struct EcRequestDisablePs2Emulation {
1236
+ pub disable : u8 ,
1237
+ }
1238
+
1239
+ impl EcRequest < ( ) > for EcRequestDisablePs2Emulation {
1240
+ fn command_id ( ) -> EcCommands {
1241
+ EcCommands :: DisablePs2Emulation
1242
+ }
1243
+ }
1244
+
1234
1245
#[ repr( u8 ) ]
1235
1246
#[ derive( Debug , FromPrimitive ) ]
1236
1247
pub enum FpLedBrightnessLevel {
Original file line number Diff line number Diff line change @@ -633,6 +633,13 @@ impl CrosEc {
633
633
Ok ( ( kblight. duty / ( PWM_MAX_DUTY / 100 ) ) as u8 )
634
634
}
635
635
636
+ pub fn ps2_emulation_enable ( & self , enable : bool ) -> EcResult < ( ) > {
637
+ EcRequestDisablePs2Emulation {
638
+ disable : !enable as u8 ,
639
+ }
640
+ . send_command ( self )
641
+ }
642
+
636
643
pub fn fan_set_rpm ( & self , fan : Option < u32 > , rpm : u32 ) -> EcResult < ( ) > {
637
644
if let Some ( fan_idx) = fan {
638
645
EcRequestPwmSetFanTargetRpmV1 { rpm, fan_idx } . send_command ( self )
Original file line number Diff line number Diff line change @@ -188,6 +188,11 @@ struct ClapCli {
188
188
#[ arg( long, value_parser=maybe_hex:: <u64 >) ]
189
189
rgbkbd : Vec < u64 > ,
190
190
191
+ /// Control PS2 touchpad emulation (DEBUG COMMAND, if touchpad not working, reboot system)
192
+ #[ clap( value_enum, hide( true ) ) ]
193
+ #[ arg( long) ]
194
+ ps2_enable : Option < bool > ,
195
+
191
196
/// Set tablet mode override
192
197
#[ clap( value_enum) ]
193
198
#[ arg( long) ]
@@ -393,6 +398,7 @@ pub fn parse(args: &[String]) -> Cli {
393
398
fp_brightness : args. fp_brightness ,
394
399
kblight : args. kblight ,
395
400
rgbkbd : args. rgbkbd ,
401
+ ps2_enable : args. ps2_enable ,
396
402
tablet_mode : args. tablet_mode ,
397
403
touchscreen_enable : args. touchscreen_enable ,
398
404
stylus_battery : args. stylus_battery ,
Original file line number Diff line number Diff line change @@ -182,6 +182,7 @@ pub struct Cli {
182
182
pub fp_brightness : Option < Option < u8 > > ,
183
183
pub kblight : Option < Option < u8 > > ,
184
184
pub rgbkbd : Vec < u64 > ,
185
+ pub ps2_enable : Option < bool > ,
185
186
pub tablet_mode : Option < TabletModeArg > ,
186
187
pub touchscreen_enable : Option < bool > ,
187
188
pub stylus_battery : bool ,
@@ -823,6 +824,8 @@ pub fn run_with_args(args: &Cli, _allupdate: bool) -> i32 {
823
824
} ) ;
824
825
ec. rgbkbd_set_color ( start_key, colors. collect ( ) ) . unwrap ( ) ;
825
826
}
827
+ } else if let Some ( enable) = args. ps2_enable {
828
+ print_err ( ec. ps2_emulation_enable ( enable) ) ;
826
829
} else if let Some ( None ) = args. kblight {
827
830
print ! ( "Keyboard backlight: " ) ;
828
831
if let Some ( percentage) = print_err ( ec. get_keyboard_backlight ( ) ) {
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ pub fn parse(args: &[String]) -> Cli {
95
95
fp_brightness : None ,
96
96
kblight : None ,
97
97
rgbkbd : vec ! [ ] ,
98
+ ps2_enable : None ,
98
99
tablet_mode : None ,
99
100
touchscreen_enable : None ,
100
101
stylus_battery : false ,
@@ -361,6 +362,26 @@ pub fn parse(args: &[String]) -> Cli {
361
362
println ! ( "--rgbkbd requires at least 2 arguments, the start key and an RGB value" ) ;
362
363
vec ! [ ]
363
364
}
365
+ } else if arg == "--ps2-enable" {
366
+ cli. ps2_enable = if args. len ( ) > i + 1 {
367
+ let enable_arg = & args[ i + 1 ] ;
368
+ if enable_arg == "true" {
369
+ Some ( true )
370
+ } else if enable_arg == "false" {
371
+ Some ( false )
372
+ } else {
373
+ println ! (
374
+ "Need to provide a value for --ps2-enable: '{}'. {}" ,
375
+ args[ i + 1 ] ,
376
+ "Must be `true` or `false`" ,
377
+ ) ;
378
+ None
379
+ }
380
+ } else {
381
+ println ! ( "Need to provide a value for --tablet-mode. One of: `auto`, `tablet` or `laptop`" ) ;
382
+ None
383
+ } ;
384
+ found_an_option = true ;
364
385
} else if arg == "--tablet-mode" {
365
386
cli. tablet_mode = if args. len ( ) > i + 1 {
366
387
let tablet_mode_arg = & args[ i + 1 ] ;
You can’t perform that action at this time.
0 commit comments