@@ -64,6 +64,7 @@ pub extern "C" fn uefi_start(_handle: Handle, st: &'static table::SystemTable) -
6464 {
6565 stdout. enable_cursor ( true ) . expect ( "Failed to enable cursor" ) ;
6666 stdout. set_cursor_position ( 24 , 0 ) . expect ( "Failed to move cursor" ) ;
67+ stdout. enable_cursor ( false ) . expect ( "Failed to enable cursor" ) ;
6768
6869 // This will make this `info!` line be (somewhat) centered.
6970 info ! ( "# uefi-rs test runner" ) ;
@@ -115,25 +116,25 @@ pub extern "C" fn uefi_start(_handle: Handle, st: &'static table::SystemTable) -
115116 info ! ( "" ) ;
116117
117118 {
118- let mut pointer = uefi_utils:: proto:: find_protocol :: < uefi:: proto:: console:: pointer:: Pointer > ( )
119- . expect ( "No pointer device was found" ) ;
119+ if let Some ( mut pointer) = uefi_utils:: proto:: find_protocol :: < uefi:: proto:: console:: pointer:: Pointer > ( ) {
120+ let pointer = unsafe { pointer . as_mut ( ) } ;
120121
121- let pointer = unsafe { pointer. as_mut ( ) } ;
122+ pointer. reset ( false ) . expect ( "Failed to reset pointer device" ) ;
122123
123- pointer. reset ( false ) . expect ( "Failed to reset pointer device" ) ;
124-
125- if let Ok ( state) = pointer. state ( ) {
126- info ! ( "Pointer State: {:#?}" , state) ;
124+ if let Ok ( state) = pointer. state ( ) {
125+ info ! ( "Pointer State: {:#?}" , state) ;
126+ } else {
127+ error ! ( "Failed to retrieve pointer state" ) ;
128+ }
127129 } else {
128- error ! ( "Failed to retrieve pointer state " ) ;
130+ warn ! ( "No pointer device found " ) ;
129131 }
130132 }
131133
132- stdout. enable_cursor ( false ) . unwrap ( ) ;
133-
134134 info ! ( "" ) ;
135135
136- timeout ! ( "Testing UEFI graphics in {} second(s)..." , 5 ) ;
136+ timeout ! ( "Testing UEFI graphics in {} second(s)..." , 3 ) ;
137+ stdout. reset ( false ) . unwrap ( ) ;
137138
138139 // Draw some graphics.
139140
@@ -143,29 +144,41 @@ pub extern "C" fn uefi_start(_handle: Handle, st: &'static table::SystemTable) -
143144 if let Some ( mut gop_proto) = uefi_utils:: proto:: find_protocol :: < GraphicsOutput > ( ) {
144145 let gop = unsafe { gop_proto. as_mut ( ) } ;
145146
146- // First, fill the screen with color.
147+ // Set a larger graphics mode.
148+ {
149+ // We know for sure QEMU has a 1024x768, mode.
150+ let mode = gop. modes ( )
151+ . find ( |ref mode| {
152+ let info = mode. info ( ) ;
153+
154+ info. resolution ( ) == ( 1024 , 768 )
155+ } )
156+ . unwrap ( ) ;
157+
158+ gop. set_mode ( mode) . expect ( "Failed to set graphics mode" ) ;
159+ }
160+
161+ // Fill the screen with color.
147162 {
148163 let op = BltOp :: VideoFill {
149164 // Cornflower blue.
150165 color : BltPixel :: new ( 100 , 149 , 237 ) ,
151166 dest : ( 0 , 0 ) ,
152- dims : ( 32 , 32 ) ,
167+ dims : ( 1024 , 768 ) ,
153168 } ;
154169
155170 gop. blt ( op) . expect ( "Failed to fill screen with color" ) ;
156171 }
157172
158- bt. stall ( 1_000_000 ) ;
173+ bt. stall ( 3_000_000 ) ;
159174 } else {
160175 warn ! ( "UEFI Graphics Output Protocol is not supported" ) ;
161176 }
162177
163178 // TODO: also test manipulating the pixel buffer directly.
164179 }
165180
166- info ! ( "" ) ;
167-
168- timeout ! ( "Testing complete, shutting down in {} second(s)..." , 5 ) ;
181+ timeout ! ( "Testing complete, shutting down in {} second(s)..." , 3 ) ;
169182
170183 let rt = st. runtime ;
171184 rt. reset ( table:: runtime:: ResetType :: Shutdown , Status :: Success , None ) ;
0 commit comments