Commit Graph

10 Commits

Author SHA1 Message Date
nevaforget baada36222 fix: reject out-of-range led brightness instead of silently clamping
led accepted any u16 and main.rs clamped to 0..=1000 with no feedback,
inconsistent with sidetone which rejects out-of-range at parse time.
Add a clap range validator (0..=1000) and drop the silent clamp, so
invalid input now fails loudly.

Further quality-audit follow-ups:
- remove dead BragiDevice::open() (no caller; binary uses open_with_verbose)
- add tests: led range validation, format_battery for all status
  variants, waybar "unknown" class

Bump 0.1.2 -> 0.1.3.
2026-06-10 17:51:40 +02:00
nevaforget 914ddf114e refactor: consume library crate from binary
main.rs declared its own module tree (mod bragi, cli, ...) while lib.rs
re-exported the same modules. The binary recompiled everything without
using the library, producing 9 spurious dead-code warnings for items
that are actually exercised by the integration tests via the library.

Import from the corsairctl library instead. No functional change;
eliminates all 9 warnings.
2026-06-10 16:37:08 +02:00
nevaforget 960bc60b20 feat: show sidetone level in Waybar tooltip
Tooltip now shows "HS80: 42% — Discharging | Sidetone: 10/23" when
the ALSA sidetone control is available. Falls back gracefully to
battery-only tooltip when sidetone cannot be read.

Bump version to 0.1.1.
2026-04-09 17:13:41 +02:00
nevaforget 25eacfc02d fix: Audit-Befunde in Protokoll-Parsing, Error-Handling und Eingabe-Validierung
BragiResponse-Felder korrekt zugeordnet (endpoint=raw[1], command=raw[2],
status=raw[3]) gemäß Protokoll-Doku. PropertyNotSupported durch DeviceError
ersetzt, parse_response_validated in device.rs aktiviert, flush() mit
Iterationslimit gegen Endlosschleifen, Sidetone-Range per clap validiert
statt clamp, JSON-Escaping im hidpp-battery-waybar.sh, udev auf uaccess
umgestellt. 52 Tests grün.
2026-03-28 00:37:36 +01:00
nevaforget dd410de49d fix: Flush vor jeder Property-Query gegen Response-Mixups
Der HID-Puffer kann veraltete Antworten von vorherigen Queries
enthalten. Flush vor jedem send_recv stellt sicher, dass wir
die Antwort auf unsere aktuelle Anfrage lesen.
2026-03-27 23:33:04 +01:00
nevaforget f3a4bf82a8 fix: 5ms Sleep vor HID-Read gegen Response-Mixups
Komplett ohne Sleep kam es sporadisch zu vertauschten Antworten
(267% Batterie = PID-Response statt Battery-Response). 5ms reicht
als Verarbeitungszeit für das Gerät, ist aber 10x schneller als
die ursprünglichen 50ms aus der Python-Referenz.
2026-03-27 23:27:50 +01:00
nevaforget a9d526023d fix: Audit-Findings behoben (Perf, Security, Quality)
- Sleep vor HID-Reads entfernt — read_timeout reicht als
  Synchronisation, spart ~300ms pro Aufruf
- udev-Regel: MODE 0660 + GROUP plugdev statt world-writable 0666
- Eigener CorsairError::SidetoneNotFound für fehlende ALSA-Controls
- Response-Validierung vorbereitet (parse_response_validated),
  Korrelation noch deaktiviert da Response-Format andere Endpoint-IDs
  nutzt als das Request-Format (0x00/0x01 vs 0x08/0x09)
- Protokoll-Doku zum Response-Format korrigiert
- 18 neue Tests für output.rs (Waybar-JSON Formatierung + Grenzwerte)
2026-03-27 23:11:50 +01:00
nevaforget 488c4c2631 fix: BatteryStatus-Mapping empirisch korrigiert
Byte-Zuordnung am echten HS80 verifiziert (Kabel ein/aus):
  0x01 = Charging, 0x02 = Discharging, 0x03 = Low, 0x04 = Full
Weicht vom ckb-next-Mapping ab. Verbose-Flag zeigt jetzt auch
Property-Queries für weitere Diagnose.
2026-03-27 22:16:50 +01:00
nevaforget 812d14b81a fix: Device-Discovery und Sidetone gegen echte Hardware korrigiert
- PID-Filter in find_and_open(), damit nicht die Harpoon-Maus statt
  dem HS80 geöffnet wird
- ALSA Sidetone: Card-Suche über Sidetone-Control statt Kartenname
  (war abgeschnitten zu "Gamin")
- Verbose-Flag (-v) für Debug-Output der Init-Sequenz
2026-03-27 22:10:40 +01:00
nevaforget c5f8625345 feat: initiale Implementierung von corsairctl
Rust CLI-Tool für Corsair Bragi-Geräte (HS80 RGB Wireless, etc.).
Implementiert Protokoll-Kern, HID-Kommunikation, BragiDevice mit
RAII-Lifecycle, CLI-Subcommands (battery, sidetone, led, info, json,
udev), ALSA-Sidetone-Steuerung und Waybar-JSON-Output.

24 Unit-Tests für Packet-Bau, Response-Parsing und Property-Enums.
2026-03-27 17:34:37 +01:00