lib.rs (1410B)
1 //! scarlett-core — clean-room Rust implementation of the Focusrite "scarlett2" 2 //! USB control protocol (what Focusrite Control speaks to Scarlett / Clarett / 3 //! Vocaster interfaces). 4 //! 5 //! Protocol facts (constants, packet layout, config offsets) are derived from the 6 //! GPL Linux kernel driver `sound/usb/mixer_scarlett2.c` and `alsa-scarlett-gui`, 7 //! and confirmed against real hardware by the Phase-0 spike. No GPL source is 8 //! copied — only the wire format, which is interoperability fact. 9 //! 10 //! ## Validated transport (macOS, Scarlett 18i20 3rd Gen) 11 //! - Commands go to the **vendor-specific interface (class 0xFF, wIndex 3)** over 12 //! endpoint 0: OUT `0x21`/req 2, IN `0xA1`/req 3, raw priming read req 0. 13 //! - The interrupt notify endpoint can't be claimed while FocusriteControlServer 14 //! holds it, so live updates are obtained by **polling**. 15 //! 16 //! ## Layers 17 //! - [`packet`] — the 16-byte wire packet codec. 18 //! - [`transport`] — [`transport::Transport`]: USB (nusb, EP0) or a test mock. 19 //! - [`protocol`] — [`protocol::Scarlett`]: init + get/set/activate/sync primitives. 20 21 #![forbid(unsafe_code)] 22 23 pub mod controls; 24 pub mod matrix; 25 pub mod meter; 26 pub mod model; 27 pub mod mux; 28 pub mod packet; 29 pub mod ports; 30 pub mod preset; 31 pub mod protocol; 32 pub mod sources; 33 pub mod transport; 34 35 pub use protocol::Scarlett; 36 pub use transport::{Transport, TransportError, UsbTransport};