1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! # USBWatch
//!
//! A cross-platform USB device monitoring library and command-line tool.
//!
//! USBWatch provides real-time monitoring of USB device connection and
//! disconnection events on Linux and Windows systems. It offers both
//! a library API for integration into other applications and a standalone
//! command-line tool.
//!
//! ## Features
//!
//! - **Cross-platform**: Works on Linux (sysfs) and Windows (Win32 APIs)
//! - **Real-time monitoring**: Detect USB events as they happen
//! - **Multiple output formats**: Plain text and JSON
//! - **File logging**: Save events to log files
//! - **Async/await support**: Built with Tokio for efficient I/O
//!
//! ## Quick Start
//!
//! ### Command Line Usage
//!
//! ```bash
//! # Monitor USB devices with default output
//! usbwatch
//!
//! # Monitor with JSON output
//! usbwatch --json
//!
//! # Monitor and log to file
//! usbwatch --logfile usb-events.log
//! ```
//!
//! ### Library Usage
//!
//! ```rust,no_run
//! use usbwatch_rs::{UsbWatcher, UsbDeviceInfo};
//! use tokio::sync::mpsc;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let (tx, mut rx) = mpsc::channel(100);
//! let watcher = UsbWatcher::new(tx)?;
//!
//! // Start monitoring in a background task
//! tokio::spawn(async move {
//! if let Err(e) = watcher.start_monitoring().await {
//! eprintln!("Monitoring error: {}", e);
//! }
//! });
//!
//! // Process device events
//! while let Some(device_info) = rx.recv().await {
//! println!("Device event: {}", device_info);
//! }
//!
//! Ok(())
//! }
//! ```
//!
//! ## Platform Support
//!
//! - **Linux**: Uses sysfs filesystem (`/sys/bus/usb/devices`)
//! - **Windows**: Uses Win32 Device Installation APIs
//!
//! ## Error Handling
//!
//! All public APIs use `Result` types for proper error handling. Platform-specific
//! errors are wrapped in boxed `std::error::Error` for consistency.
// Re-export commonly used types
pub use ;
pub use ;
pub use UsbWatcher;
/// Library version information
pub const VERSION: &str = env!;
/// Library name
pub const NAME: &str = env!;
/// Library description
pub const DESCRIPTION: &str = env!;