File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed
framework_lib/src/chromium_ec Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ struct CrosEcCommandV2 {
5555 data : [ u8 ; IN_SIZE ] ,
5656}
5757
58- const DEV_PATH : & str = "/dev/cros_ec" ;
58+ pub const DEV_PATH : & str = "/dev/cros_ec" ;
5959
6060lazy_static ! {
6161 static ref CROS_EC_FD : Arc <Mutex <Option <std:: fs:: File >>> = Arc :: new( Mutex :: new( None ) ) ;
Original file line number Diff line number Diff line change @@ -240,14 +240,20 @@ impl Default for CrosEc {
240240///
241241/// Depending on the availability we choose the first one as default
242242fn available_drivers ( ) -> Vec < CrosEcDriverType > {
243- vec ! [
244- #[ cfg( feature = "win_driver" ) ]
245- CrosEcDriverType :: Windows ,
246- #[ cfg( feature = "cros_ec_driver" ) ]
247- CrosEcDriverType :: CrosEc ,
248- #[ cfg( not( feature = "windows" ) ) ]
249- CrosEcDriverType :: Portio ,
250- ]
243+ let mut drivers = vec ! [ ] ;
244+
245+ #[ cfg( feature = "win_driver" ) ]
246+ drivers. push ( CrosEcDriverType :: Windows ) ;
247+
248+ #[ cfg( feature = "cros_ec_driver" ) ]
249+ if std:: path:: Path :: new ( cros_ec:: DEV_PATH ) . exists ( ) {
250+ drivers. push ( CrosEcDriverType :: CrosEc ) ;
251+ }
252+
253+ #[ cfg( not( feature = "windows" ) ) ]
254+ drivers. push ( CrosEcDriverType :: Portio ) ;
255+
256+ drivers
251257}
252258
253259impl CrosEc {
You can’t perform that action at this time.
0 commit comments