// ABOUTME: Zentrales Error-Handling für corsairctl. // ABOUTME: Definiert CorsairError als thiserror-Enum für alle Fehlerfälle. use thiserror::Error; #[derive(Debug, Error)] pub enum CorsairError { #[error("Kein Corsair-Gerät gefunden (VID 0x1B1C, Interface 3)")] DeviceNotFound, #[error("ALSA Sidetone-Control nicht gefunden — kein Corsair USB-Audio-Interface erkannt")] SidetoneNotFound, #[error("Headset antwortet nicht — möglicherweise ausgeschaltet")] HeadsetOffline, #[error("Gerät-Fehler: Property 0x{property:02X} nicht unterstützt")] PropertyNotSupported { property: u8 }, #[error("Ungültige Antwort: erwartet mindestens {expected} Bytes, bekommen {got}")] ResponseTooShort { expected: usize, got: usize }, #[error("Unerwartete Antwort: Endpoint 0x{endpoint:02X}, Command 0x{command:02X}")] UnexpectedResponse { endpoint: u8, command: u8 }, #[error("HID-Fehler: {0}")] Hid(#[from] hidapi::HidError), #[error("ALSA-Fehler: {0}")] Alsa(#[from] alsa::Error), } pub type Result = std::result::Result;