@@ -64,6 +64,7 @@ pub extern "C" fn uefi_start(_handle: Handle, st: &'static table::SystemTable) -
64
64
{
65
65
stdout. enable_cursor ( true ) . expect ( "Failed to enable cursor" ) ;
66
66
stdout. set_cursor_position ( 24 , 0 ) . expect ( "Failed to move cursor" ) ;
67
+ stdout. enable_cursor ( false ) . expect ( "Failed to enable cursor" ) ;
67
68
68
69
// This will make this `info!` line be (somewhat) centered.
69
70
info ! ( "# uefi-rs test runner" ) ;
@@ -115,25 +116,25 @@ pub extern "C" fn uefi_start(_handle: Handle, st: &'static table::SystemTable) -
115
116
info ! ( "" ) ;
116
117
117
118
{
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 ( ) } ;
120
121
121
- let pointer = unsafe { pointer. as_mut ( ) } ;
122
+ pointer. reset ( false ) . expect ( "Failed to reset pointer device" ) ;
122
123
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
+ }
127
129
} else {
128
- error ! ( "Failed to retrieve pointer state " ) ;
130
+ warn ! ( "No pointer device found " ) ;
129
131
}
130
132
}
131
133
132
- stdout. enable_cursor ( false ) . unwrap ( ) ;
133
-
134
134
info ! ( "" ) ;
135
135
136
- timeout ! ( "Testing UEFI graphics in {} second(s)..." , 5 ) ;
136
+ timeout ! ( "Testing UEFI graphics in {} second(s)..." , 3 ) ;
137
+ stdout. reset ( false ) . unwrap ( ) ;
137
138
138
139
// Draw some graphics.
139
140
@@ -143,29 +144,41 @@ pub extern "C" fn uefi_start(_handle: Handle, st: &'static table::SystemTable) -
143
144
if let Some ( mut gop_proto) = uefi_utils:: proto:: find_protocol :: < GraphicsOutput > ( ) {
144
145
let gop = unsafe { gop_proto. as_mut ( ) } ;
145
146
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.
147
162
{
148
163
let op = BltOp :: VideoFill {
149
164
// Cornflower blue.
150
165
color : BltPixel :: new ( 100 , 149 , 237 ) ,
151
166
dest : ( 0 , 0 ) ,
152
- dims : ( 32 , 32 ) ,
167
+ dims : ( 1024 , 768 ) ,
153
168
} ;
154
169
155
170
gop. blt ( op) . expect ( "Failed to fill screen with color" ) ;
156
171
}
157
172
158
- bt. stall ( 1_000_000 ) ;
173
+ bt. stall ( 3_000_000 ) ;
159
174
} else {
160
175
warn ! ( "UEFI Graphics Output Protocol is not supported" ) ;
161
176
}
162
177
163
178
// TODO: also test manipulating the pixel buffer directly.
164
179
}
165
180
166
- info ! ( "" ) ;
167
-
168
- timeout ! ( "Testing complete, shutting down in {} second(s)..." , 5 ) ;
181
+ timeout ! ( "Testing complete, shutting down in {} second(s)..." , 3 ) ;
169
182
170
183
let rt = st. runtime ;
171
184
rt. reset ( table:: runtime:: ResetType :: Shutdown , Status :: Success , None ) ;
0 commit comments