Convert to cargo workspace with lib/ and cli/ crates. Add Nix flake for building and development. Extract handle_urb_loop and add read_urb_command to the library for CLI consumption. Implement the usbip-rs CLI binary with clap subcommands: - client listen: accept incoming connections via vhci_hcd sysfs - host connect: passthrough real USB devices via nusb - test_hid connect: export a simulated HID keyboard for testing Add vsock transport layer and vhci_hcd sysfs interaction module. Apply rustfmt formatting project-wide and add rustfmt/clippy to devShell. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
16 lines
409 B
Rust
16 lines
409 B
Rust
use std::net::*;
|
|
use std::sync::Arc;
|
|
use std::time::Duration;
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
env_logger::init();
|
|
let server = Arc::new(usbip_rs::UsbIpServer::new_from_host());
|
|
let addr = SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 3240);
|
|
tokio::spawn(usbip_rs::server(addr, server));
|
|
|
|
loop {
|
|
// sleep 1s
|
|
tokio::time::sleep(Duration::new(1, 0)).await;
|
|
}
|
|
}
|