From 23a46268b41c48708d274b0beeb3f59610eae9d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gianguido=20Sor=C3=A0?= Date: Fri, 8 Jul 2022 18:11:10 +0200 Subject: [PATCH] match against percursor usb pid/vid --- apps/vault/tools/totpbackup-rs/src/main.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/vault/tools/totpbackup-rs/src/main.rs b/apps/vault/tools/totpbackup-rs/src/main.rs index b9843b730..e1f487c28 100644 --- a/apps/vault/tools/totpbackup-rs/src/main.rs +++ b/apps/vault/tools/totpbackup-rs/src/main.rs @@ -191,6 +191,8 @@ impl std::fmt::Display for ProgramError { impl std::error::Error for ProgramError {} const OKAY_CANARY: &[u8] = &[0xca, 0xfe, 0xba, 0xbe]; +const PRECURSOR_VENDOR_ID: u16 = 0x1209; +const PRECURSOR_PRODUCT_ID: u16 = 0x3613; fn main() -> Result<(), Box> { let wp: WithPositional = argh::from_env(); @@ -201,7 +203,8 @@ fn main() -> Result<(), Box> { let mut precursor: Option<&hidapi::DeviceInfo> = None; for i in dl { - if i.product_string().unwrap() == "Precursor" { + println!("{:x?}", i); + if i.product_id() == PRECURSOR_PRODUCT_ID && i.vendor_id() == PRECURSOR_VENDOR_ID { precursor = Some(i); break; }