Skip to content

Commit 852378e

Browse files
iffseJohnAZoidberg
authored andcommitted
chore: send every error to stderr
1 parent 5a45784 commit 852378e

File tree

9 files changed

+115
-113
lines changed

9 files changed

+115
-113
lines changed

framework_lib/src/capsule.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ pub fn dump_winux_image(data: &[u8], header: &DisplayCapsule, filename: &str) {
185185
{
186186
let ret = crate::fw_uefi::fs::shell_write_file(filename, image);
187187
if let Err(err) = ret {
188-
println!("Failed to dump winux image: {:?}", err);
188+
eprintln!("Failed to dump winux image: {:?}", err);
189189
}
190190
}
191191
}

framework_lib/src/ccgx/hid.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ pub fn flash_firmware(fw_binary: &[u8]) {
290290
let versions = if let Some(versions) = ccgx::binary::read_versions(fw_binary, SiliconId::Ccg3) {
291291
versions
292292
} else {
293-
println!("Incompatible firmware. Need CCG3 firmware.");
293+
eprintln!("Incompatible firmware. Need CCG3 firmware.");
294294
return;
295295
};
296296

@@ -302,7 +302,7 @@ pub fn flash_firmware(fw_binary: &[u8]) {
302302
} else if util::find_sequence(fw_binary, dp_string).is_some() {
303303
[DP_CARD_PID]
304304
} else {
305-
println!("Incompatible firmware. Need DP/HDMI Expansion Card Firmware.");
305+
eprintln!("Incompatible firmware. Need DP/HDMI Expansion Card Firmware.");
306306
return;
307307
};
308308

@@ -319,7 +319,7 @@ pub fn flash_firmware(fw_binary: &[u8]) {
319319
let mut api = HidApi::new().unwrap();
320320
let devices = find_devices(&api, &filter_devs, None);
321321
if devices.is_empty() {
322-
println!("No compatible Expansion Card connected");
322+
eprintln!("No compatible Expansion Card connected");
323323
return;
324324
};
325325
for dev_info in devices {

framework_lib/src/ccgx/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ fn parse_metadata_cyacd2(buffer: &[u8]) -> Option<(u32, u32)> {
302302
if metadata.metadata_version == 1 {
303303
Some((metadata.fw_start, metadata.fw_size))
304304
} else {
305-
println!("Unknown CCG8 metadata version");
305+
eprintln!("Unknown CCG8 metadata version");
306306
None
307307
}
308308
} else {

framework_lib/src/chromium_ec/cros_ec.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ fn init() {
7979
return;
8080
}
8181
match std::fs::File::open(DEV_PATH) {
82-
Err(why) => println!("Failed to open {}. Because: {:?}", DEV_PATH, why),
82+
Err(why) => eprintln!("Failed to open {}. Because: {:?}", DEV_PATH, why),
8383
Ok(file) => *device = Some(file),
8484
};
8585
// 2. Read max 80 bytes and check if equal to "1.0.0"

framework_lib/src/chromium_ec/mod.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -975,7 +975,7 @@ impl CrosEc {
975975
if !dry_run {
976976
let res = self.write_ec_flash_chunk(addr + offset as u32, chunk);
977977
if let Err(err) = res {
978-
println!(" Failed to write chunk: {:?}", err);
978+
eprintln!(" Failed to write chunk: {:?}", err);
979979
return Err(err);
980980
}
981981
}
@@ -1062,7 +1062,7 @@ impl CrosEc {
10621062
// TODO: We don't want to crash here. But returning no data doesn't seem optimal
10631063
// either
10641064
// return Err(EcError::DeviceError("Execution interrupted".to_string()));
1065-
println!("Execution interrupted");
1065+
eprintln!("Execution interrupted");
10661066
return Ok(vec![]);
10671067
}
10681068

@@ -1142,15 +1142,15 @@ impl CrosEc {
11421142
// TODO: Does zephyr always start like this?
11431143
let zephyr_start = [0x5E, 0x4D, 0x3B, 0x2A];
11441144
if data[0..4] != legacy_start && data[0..4] != zephyr_start {
1145-
println!(" INVALID start");
1145+
eprintln!(" INVALID start");
11461146
res = Err(EcError::DeviceError("INVALID start".to_string()));
11471147
}
11481148
// Legacy EC is all 0xFF until the end of the row
11491149
// Zephyr EC I'm not quite sure but it has a section of 0x00
11501150
let legacy_comp = !data[4..].iter().all(|x| *x == 0xFF);
11511151
let zephyr_comp = !data[0x20..0x40].iter().all(|x| *x == 0x00);
11521152
if legacy_comp && zephyr_comp {
1153-
println!(" INVALID end");
1153+
eprintln!(" INVALID end");
11541154
res = Err(EcError::DeviceError("INVALID end".to_string()));
11551155
}
11561156

@@ -1175,13 +1175,13 @@ impl CrosEc {
11751175
// let legacy_start = []; // TODO
11761176
// let zephyr_start = [0x80, 0x7D, 0x0C, 0x20];
11771177
// if data[0..4] != legacy_start && data[0..4] != zephyr_start {
1178-
// println!(" INVALID start");
1178+
// eprintln!(" INVALID start");
11791179
// res = Err(EcError::DeviceError("INVALID start".to_string()));
11801180
// }
11811181
// let legacy_comp = !data[4..].iter().all(|x| *x == 0xFF);
11821182
// let zephyr_comp = !data[0x20..0x2C].iter().all(|x| *x == 0x00);
11831183
// if legacy_comp && zephyr_comp {
1184-
// println!(" INVALID end");
1184+
// eprintln!(" INVALID end");
11851185
// res = Err(EcError::DeviceError("INVALID end".to_string()));
11861186
// }
11871187

@@ -1224,7 +1224,7 @@ impl CrosEc {
12241224
println!(" Erased flash flags");
12251225
res = Err(EcError::DeviceError("Erased flash flags".to_string()));
12261226
} else {
1227-
println!(" INVALID flash flags: {:02X?}", &data[0..12]);
1227+
eprintln!(" INVALID flash flags: {:02X?}", &data[0..12]);
12281228
// TODO: Disable error until I confirm flash flags on MEC
12291229
// res = Err(EcError::DeviceError("INVALID flash flags".to_string()));
12301230
}

framework_lib/src/chromium_ec/windows.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,12 @@ fn init() -> bool {
5252
match platform {
5353
Some(platform @ Platform::IntelGen11)
5454
| Some(platform @ Platform::IntelGen12)
55-
| Some(platform @ Platform::IntelGen13) => {
56-
println!("The windows driver is not enabled on {:?}.", platform);
57-
println!("Please stay tuned for future BIOS and driver updates.");
58-
println!();
55+
| Some(platform @ Platform::IntelGen13)
56+
| Some(platform @ Platform::Framework13Amd7080)
57+
| Some(platform @ Platform::Framework16Amd7080) => {
58+
eprintln!("The windows driver is not enabled on {:?}.", platform);
59+
eprintln!("Please stay tuned for future BIOS and driver updates.");
60+
eprintln!();
5961
}
6062
Some(Platform::IntelCoreUltra1) => {
6163
println!("The windows driver has been enabled since BIOS 3.06.");

0 commit comments

Comments
 (0)