mirror of
https://github.com/librekeys/picoforge.git
synced 2026-07-28 08:01:19 -07:00
restore behavior when no device found as normal offline state instead of an error
This commit is contained in:
@@ -4,6 +4,8 @@ use anyhow::{Result, anyhow};
|
||||
use rand::Rng;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::error::PFError;
|
||||
|
||||
// HID Transport Constants
|
||||
const HID_REPORT_SIZE: usize = 64;
|
||||
const HID_USAGE_PAGE_FIDO: u16 = 0xF1D0;
|
||||
@@ -35,7 +37,7 @@ impl HidTransport {
|
||||
.find(|d| d.usage_page() == HID_USAGE_PAGE_FIDO)
|
||||
.ok_or_else(|| {
|
||||
log::warn!("No FIDO device found with Usage Page 0xF1D0.");
|
||||
anyhow!("No FIDO device found. Is it plugged in?")
|
||||
PFError::NoDevice
|
||||
})?;
|
||||
|
||||
log::debug!(
|
||||
|
||||
@@ -149,8 +149,12 @@ pub fn read_device_details() -> Result<FullDeviceStatus, PFError> {
|
||||
log::info!("Starting FIDO device details read...");
|
||||
|
||||
let transport = HidTransport::open().map_err(|e| {
|
||||
log::error!("Failed to open HID transport: {}", e);
|
||||
PFError::Device(e.to_string())
|
||||
if let Some(PFError::NoDevice) = e.downcast_ref::<PFError>() {
|
||||
PFError::NoDevice
|
||||
} else {
|
||||
log::error!("Failed to open HID transport: {}", e);
|
||||
PFError::Device(e.to_string())
|
||||
}
|
||||
})?;
|
||||
|
||||
// --- 1. Get Info ---
|
||||
|
||||
Reference in New Issue
Block a user