Skip to content

Adding Ch375 dll64 access on windows #89

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ jobs:
mkdir wchisp-${{ matrix.config.arch }}
cp $WCHISP_EXE wchisp-${{ matrix.config.arch }}
cp README.md wchisp-${{ matrix.config.arch }}

if [[ "${{ matrix.config.arch }}" == "win-x64" ]]; then
cp src/CH375DLL64.dll wchisp-${{ matrix.config.arch }}
fi
shell: bash
- uses: actions/upload-artifact@v4
with:
Expand Down
21 changes: 16 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ object = { version = "0.36.0", default-features = false, features = [
] }
indicatif = "0.17"
serialport = { version = "4.5", default-features = false }
libloading = "0.8.1"
Binary file added src/CH375DLL.dll
Binary file not shown.
Binary file added src/CH375DLL64.dll
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid that packing DLL in this repo is not acceptable.
Better add a document section to tell user how to download it from WCH official.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds fair, I will add the instructions in the readme and load dll exception.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DLL has been removed from this repo in the following commits.
DLL should be already in the system if WCHISPTOOL is installed.

Binary file not shown.
23 changes: 23 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ struct Cli {
#[arg(long, short, ignore_case = true, value_enum, requires = "serial")]
baudrate: Option<Baudrate>,

/// Retry scan for certain seconds, helpful on slow USB devices
#[arg(long, short, default_value = "0")]
retry: u32,

#[command(subcommand)]
command: Option<Commands>,
}
Expand Down Expand Up @@ -141,6 +145,25 @@ fn main() -> Result<()> {
);
}

if cli.retry > 0 {
log::info!("Retrying scan for {} seconds", cli.retry);
let start_time = std::time::Instant::now();
while start_time.elapsed().as_secs() < cli.retry as u64 {
if cli.usb {
let ndevices = UsbTransport::scan_devices()?;
if ndevices > 0 {
break;
}
} else if cli.serial {
let ports = SerialTransport::scan_ports()?;
if !ports.is_empty() {
break;
}
}
sleep(Duration::from_millis(100));
}
}

match &cli.command {
None | Some(Commands::Probe {}) => {
if cli.usb {
Expand Down
Loading