Skip to content

Commit

Permalink
Refactor joystick device handling in main.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdewid committed Oct 3, 2024
1 parent 3b9bc30 commit b82fe8f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions glonax-input/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ struct Args {
path: Option<std::path::PathBuf>,
/// Gamepad input device.
#[arg(value_hint = ValueHint::FilePath)]
device: String, // TODO: Why not use pathbuf?
device: std::path::PathBuf,
/// Configure failsafe mode.
#[arg(short, long, default_value_t = true)]
fail_safe: bool,
Expand Down Expand Up @@ -126,9 +126,9 @@ async fn run(config: config::Config, args: Args) -> anyhow::Result<()> {
log::debug!("Runtime version: {}", VERSION);
log::debug!("Socket path: {}", socket_path.display());

let mut joystick = joystick::Joystick::open(std::path::Path::new(&args.device)).await?;
let mut joystick = joystick::Joystick::open(&args.device).await?;

log::debug!("Using joystick {}", args.device);
log::debug!("Using joystick {}", args.device.display());

let mut input_device: Box<dyn crate::gamepad::InputDevice> = match args.mode {
ControlMode::Xbox => Box::<gamepad::XboxController>::default(),
Expand Down

0 comments on commit b82fe8f

Please sign in to comment.