File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed
src/proto/console/pointer
uefi-test-runner/src/proto/console Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -27,13 +27,18 @@ impl Pointer {
27
27
28
28
/// Retrieves the pointer device's current state.
29
29
///
30
+ /// Will return None if the state has not changed since the last query.
31
+ ///
30
32
/// # Errors
31
- /// - `NotReady` is returned if the state hasn't changed since the last call.
32
33
/// - `DeviceError` if there was an issue with the pointer device.
33
- pub fn state ( & self ) -> Result < PointerState > {
34
+ pub fn state ( & self ) -> Result < Option < PointerState > > {
34
35
let mut pointer_state = unsafe { mem:: uninitialized ( ) } ;
35
36
36
- ( self . get_state ) ( self , & mut pointer_state) . into_with ( || pointer_state)
37
+ match ( self . get_state ) ( self , & mut pointer_state) {
38
+ Status :: Success => Ok ( Some ( pointer_state) ) ,
39
+ Status :: NotReady => Ok ( None ) ,
40
+ error => Err ( error)
41
+ }
37
42
}
38
43
39
44
/// Returns a reference to the pointer device information.
Original file line number Diff line number Diff line change @@ -12,10 +12,11 @@ pub fn test(bt: &BootServices) {
12
12
. reset ( false )
13
13
. expect ( "Failed to reset pointer device" ) ;
14
14
15
- if let Ok ( state) = pointer. state ( ) {
16
- info ! ( "Pointer State: {:#?}" , state) ;
15
+ let state = pointer. state ( ) . expect ( "Failed to retrieve pointer state" ) ;
16
+ if let Some ( state) = state {
17
+ info ! ( "New pointer State: {:#?}" , state) ;
17
18
} else {
18
- error ! ( "Failed to retrieve pointer state " ) ;
19
+ info ! ( "Pointer state has not changed since the last query " ) ;
19
20
}
20
21
} else {
21
22
warn ! ( "No pointer device found" ) ;
You can’t perform that action at this time.
0 commit comments