docs: fix spec gaps — add consts.rs Direction, device.rs Version, protocol comment

Spec reviewer caught three missing items that would cause build failures:
- pub use rusb::Direction needs local replacement enum
- rusb::Version conversion impls in device.rs need removal
- stale rusb::Direction comment in usbip_protocol.rs

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Davíð Steinn Geirsson 2026-03-25 13:19:48 +00:00
parent 8002dfa9e5
commit c2742138f7

View file

@ -18,11 +18,31 @@ Remove the entire directory containing `cdc_acm_serial.rs`, `hid_keyboard.rs`, a
- Delete the `rusb = "0.9.3"` dependency
- Fix the `serde` feature from `["dep:serde", "rusb/serde"]` to `["dep:serde"]`
### 3. Remove rusb types from `lib/src/host.rs`
### 3. Replace `pub use rusb::Direction` in `lib/src/consts.rs`
Replace `pub use rusb::Direction;` with a locally-defined enum preserving the USB endpoint address direction bit values:
```rust
/// USB endpoint direction
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Direction {
Out = 0x00,
In = 0x80,
}
```
### 4. Remove rusb `Version` conversions from `lib/src/device.rs`
- Remove `use rusb::Version as rusbVersion;`
- Delete the `From<rusbVersion> for Version` and `From<Version> for rusbVersion` impl blocks
These are only used by the rusb enumeration path being deleted.
### 5. Remove rusb types from `lib/src/host.rs`
Delete `RusbUsbHostInterfaceHandler` (struct + `UsbInterfaceHandler` impl) and `RusbUsbHostDeviceHandler` (struct + `UsbDeviceHandler` impl). Keep `nusb_speed_to_linux()` and both `NusbUsbHost*Handler` types unchanged.
### 4. Replace rusb enumeration in `lib/src/lib.rs`
### 6. Replace rusb enumeration in `lib/src/lib.rs`
- Remove `use rusb::*`
- Delete `with_rusb_device_handles()` and `with_rusb_devices()`
@ -52,7 +72,11 @@ where
The filter type changes from `FnMut(&rusb::Device<GlobalContext>)` to `FnMut(&nusb::DeviceInfo)`.
### 5. Verification
### 7. Update stale comment in `lib/src/usbip_protocol.rs`
Update the comment on line 49 ("Must not be confused with rusb::Direction") to reference the local `Direction` enum in `consts.rs` instead.
### 8. Verification
- `cargo build` succeeds
- `cargo test` passes