Description
The Python halpi CLI supports halpi usb get as an explicit action to show USB port states. The Rust implementation only supports halpi usb (with no arguments) to achieve the same result.
Python CLI Behavior
halpi usb # Show all port states
halpi usb get # Show all port states (explicit action)
halpi usb enable 0 # Enable USB port 0
halpi usb disable 0 # Disable USB port 0
Current Rust CLI Behavior
halpi usb # Show all port states ✓
halpi usb get # ERROR: unrecognized subcommand ✗
halpi usb enable 0 # Enable USB port 0 ✓
halpi usb disable 0 # Disable USB port 0 ✓
Reference Implementation
Python implementation: HALPI2-python-daemon/src/halpi/cli.py:398-436
@app.command("usb")
def usb(
action: str | None = typer.Argument(
None,
help=(
"Action: 'get' to show port states, "
"'enable' or 'disable' to control ports, or leave empty to show all ports"
),
),
target: str | None = typer.Argument(
None,
help="Port number (0-3) or 'all' for all ports (required for enable/disable)",
),
) -> None:
"""Control USB port power states."""
if action is None or action == "get":
# Show USB port states
ports = asyncio.run(async_get_usb_ports(state["socket"]))
# ... display table ...
Proposed Implementation
Add a Get variant to UsbAction:
#[derive(Subcommand)]
enum UsbAction {
/// Show USB port states
Get,
/// Enable a USB port (0-3 or 'all')
Enable {
/// Port number (0-3) or 'all'
port: String,
},
/// Disable a USB port (0-3 or 'all')
Disable {
/// Port number (0-3) or 'all'
port: String,
},
}
The Get action should behave identically to calling halpi usb with no arguments.
API Compatibility
This is a minor CLI compatibility issue. While halpi usb (no args) works fine, users migrating from the Python version may expect halpi usb get to work as well.
Priority
Low - The functionality is already available via halpi usb, this is just an alias for convenience and compatibility.
Description
The Python
halpiCLI supportshalpi usb getas an explicit action to show USB port states. The Rust implementation only supportshalpi usb(with no arguments) to achieve the same result.Python CLI Behavior
Current Rust CLI Behavior
Reference Implementation
Python implementation:
HALPI2-python-daemon/src/halpi/cli.py:398-436Proposed Implementation
Add a
Getvariant toUsbAction:The
Getaction should behave identically to callinghalpi usbwith no arguments.API Compatibility
This is a minor CLI compatibility issue. While
halpi usb(no args) works fine, users migrating from the Python version may expecthalpi usb getto work as well.Priority
Low - The functionality is already available via
halpi usb, this is just an alias for convenience and compatibility.