From 6cda4afdea10882dcb7bb60e1ee11fda5c599494 Mon Sep 17 00:00:00 2001 From: "Rivas Paz, Jose L" Date: Fri, 21 Aug 2026 09:40:01 +0200 Subject: [PATCH] lib: gate `clear` command and `Write` behind `control_commands` feature This patch indicates that the `clear` command and the io::Write import should be gated by the `control_commands` feature. The `control_commands` feature should handle the support to use Crash Log control commands and currently is the only feature in the Crash Log tool that uses writes to the linux sysfs. Signed-off-by: Rivas Paz, Jose L --- lib/src/source/pmt.rs | 2 +- lib/src/source/pmt/sysfs.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/src/source/pmt.rs b/lib/src/source/pmt.rs index fc1b133..f25c623 100644 --- a/lib/src/source/pmt.rs +++ b/lib/src/source/pmt.rs @@ -98,7 +98,7 @@ impl Pmt { Err(Error::Unsupported) } - #[cfg(target_os = "linux")] + #[cfg(all(target_os = "linux", feature = "control_commands"))] pub fn clear(&self, dev: &PmtDeviceId) -> Result<(), Error> { for endpoint in self.sysfs.get_endpoints(dev) { endpoint.clear()?; diff --git a/lib/src/source/pmt/sysfs.rs b/lib/src/source/pmt/sysfs.rs index 6ec56a1..96111b8 100644 --- a/lib/src/source/pmt/sysfs.rs +++ b/lib/src/source/pmt/sysfs.rs @@ -8,6 +8,7 @@ use crate::error::Error; use crate::region::Region; use crate::source::{Capabilities, Capability}; use std::collections::BTreeSet; +#[cfg(feature = "control_commands")] use std::io::Write; use std::path::{Path, PathBuf};