Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Linux experience for crank run --device #36

Merged
merged 5 commits into from
Feb 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "crankstart-cli"
version = "0.2.6"
version = "0.2.7"
authors = ["Rob Tsuk <rob@tsuk.com>"]
edition = "2018"
description = "A command line tool for use with [Crankstart](https://github.com/pd-rs/crankstart)."
Expand Down
14 changes: 14 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,17 @@ impl Build {
info!("datadisk cmd: {:#?}", cmd);
let _ = cmd.status()?;

// Note: this device doesn't disappear on one Linux developer's system; is this always
// true? Should we instead have a maximum delay and then continue regardless?
#[cfg(not(target_os = "linux"))]
while modem_path.exists() {
thread::sleep(duration);
}
}

#[cfg(target_os = "linux")]
println!("If your OS does not automatically mount your Playdate, please do so now.");

while !data_path.exists() {
thread::sleep(duration);
}
Expand Down Expand Up @@ -497,10 +503,18 @@ impl Build {
let _ = cmd.status()?;
}

#[cfg(target_os = "linux")]
println!("Please press 'A' on the Playdate to exit Data Disk mode.");

while !modem_path.exists() {
thread::sleep(duration);
}

// Note: this sleep was determined by testing on one Linux system and may not be
// consistent; is there a better marker that we're ready to call pdutil run?
#[cfg(target_os = "linux")]
thread::sleep(duration * 10);

let mut cmd = Command::new(&pdutil_path);
cmd.arg(modem_path)
.arg("run")
Expand Down