File tree 2 files changed +15
-9
lines changed
framework_lib/src/chromium_ec
2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ struct CrosEcCommandV2 {
55
55
data : [ u8 ; IN_SIZE ] ,
56
56
}
57
57
58
- const DEV_PATH : & str = "/dev/cros_ec" ;
58
+ pub const DEV_PATH : & str = "/dev/cros_ec" ;
59
59
60
60
lazy_static ! {
61
61
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 {
240
240
///
241
241
/// Depending on the availability we choose the first one as default
242
242
fn 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
251
257
}
252
258
253
259
impl CrosEc {
You can’t perform that action at this time.
0 commit comments