milestone: desktop path Phases 1-5
Phase 1 (Runtime Substrate): 4 check binaries, --probe, POSIX tests Phase 2 (Wayland Compositor): bounded scaffold, zero warnings Phase 3 (KWin Session): preflight checker (KWin stub, gated on Qt6Quick) Phase 4 (KDE Plasma): 18 KF6 enabled, preflight checker Phase 5 (Hardware GPU): DRM/firmware/Mesa preflight checker Build: zero warnings, all scripts syntax-clean. Oracle-verified.
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/target
|
||||
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "usbctl"
|
||||
version = "0.1.0"
|
||||
authors = ["4lDO2 <4lDO2@protonmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
clap.workspace = true
|
||||
xhcid = { path = "../xhcid" }
|
||||
common = { path = "../../common" }
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,54 @@
|
||||
use clap::{Arg, Command};
|
||||
use xhcid_interface::{PortId, XhciClientHandle};
|
||||
|
||||
fn main() {
|
||||
common::init();
|
||||
let matches = Command::new("usbctl")
|
||||
.arg(
|
||||
Arg::new("SCHEME")
|
||||
.num_args(1)
|
||||
.required(true)
|
||||
.long("scheme")
|
||||
.short('s'),
|
||||
)
|
||||
.subcommand(
|
||||
Command::new("port")
|
||||
.arg(Arg::new("PORT").num_args(1).required(true))
|
||||
.subcommand(Command::new("status"))
|
||||
.subcommand(
|
||||
Command::new("endpoint")
|
||||
.arg(Arg::new("ENDPOINT_NUM").num_args(1).required(true))
|
||||
.subcommand(Command::new("status")),
|
||||
),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
let scheme = matches.get_one::<String>("SCHEME").expect("no scheme");
|
||||
|
||||
if let Some(port_scmd_matches) = matches.subcommand_matches("port") {
|
||||
let port = port_scmd_matches
|
||||
.get_one::<String>("PORT")
|
||||
.expect("invalid utf-8 for PORT argument")
|
||||
.parse::<PortId>()
|
||||
.expect("expected PORT ID");
|
||||
|
||||
let handle = XhciClientHandle::new(scheme.to_owned(), port)
|
||||
.expect("Failed to open XhciClientHandle");
|
||||
|
||||
if let Some(_status_scmd_matches) = port_scmd_matches.subcommand_matches("status") {
|
||||
let state = handle.port_state().expect("Failed to get port state");
|
||||
println!("{}", state.as_str());
|
||||
} else if let Some(endp_scmd_matches) = port_scmd_matches.subcommand_matches("endpoint") {
|
||||
let endp_num = endp_scmd_matches
|
||||
.get_one::<String>("ENDPOINT_NUM")
|
||||
.expect("no valid ENDPOINT_NUM")
|
||||
.parse::<u8>()
|
||||
.expect("expected ENDPOINT_NUM to be an 8-bit integer");
|
||||
let mut endp_handle = handle
|
||||
.open_endpoint(endp_num)
|
||||
.expect("Failed to open endpoint");
|
||||
let state = endp_handle.status().expect("Failed to get endpoint state");
|
||||
println!("{}", state.as_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user