Skip to content

Commit

Permalink
NDA indication
Browse files Browse the repository at this point in the history
  • Loading branch information
pmnxis committed Nov 9, 2023
1 parent 5b41780 commit b7e5572
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mp-fingerprint-type/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct FirmwareFingerprint {
pub model_ver: String,
pub firmware_ver: String,
pub firmware_git_hash: String,
pub is_nda: bool,
}

#[derive(Clone, Deserialize, Serialize, Debug, PartialEq)]
Expand All @@ -32,6 +33,10 @@ impl MpFingerprint {
hex::encode_upper(toml::to_string(self).expect("Serializing toml failed"))
}

pub fn to_string_pretty(&self) -> String {
toml::to_string(self).expect("Serializing toml failed")
}

pub fn from_elf<P: AsRef<Path>>(path: P) -> Self {
let file_data = std::fs::read(path).expect("Could not read file.");
let slice = file_data.as_slice();
Expand Down Expand Up @@ -66,7 +71,8 @@ mod test {
model_name: "otp-proof-of-concept".to_owned(),
model_ver: "DUMMY-0V3".to_owned(),
firmware_ver: "0.2.0".to_owned(),
firmware_git_hash: "60b0d3d7075ffaab713ec0f85240829390328ec3".to_owned(),
firmware_git_hash: "5b417803244c8c21e77bd73d58f842066d7d29b7".to_owned(),
is_nda: false,
},
};

Expand Down
Binary file modified mp-fingerprint-type/testcase_elf_binary/otp-proof-of-concept
Binary file not shown.
1 change: 1 addition & 0 deletions otp-proof-of-concept/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ fn main() -> Result<(), ()> {
model_ver: feature_based_model_ver,
firmware_ver: main_package.version.to_string(),
firmware_git_hash: format!("{}", commit_hash),
is_nda: false,
},
};

Expand Down
15 changes: 15 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ async fn main() -> Result<(), anyhow::Error> {
println!("fingerprint : {:?}", fingerprint);
}

if !fingerprint.is_nda {
println!("Firmware binary is not NDA build. If you agree to flash, type `agree`, else type other keyword");

let mut input = String::new();
std::io::stdin().read_line(&mut input).expect("stdin error");

if input.trim().to_lowercase() != "agree" {
println!(
"Exit the job because disagree non-NDA flashing {}",
batch_count
);
break;
}
}

println!("If you ready press any key, or if you wanna stop batch task press `Q`.");

let mut input = String::new();
Expand Down

0 comments on commit b7e5572

Please sign in to comment.