Skip to content

Commit

Permalink
fix: use hardware control flow
Browse files Browse the repository at this point in the history
Windows might want to utilize a RTS/CTS control flow rather than the
UNIX XON/XOFF that works on Linux and Mac.
  • Loading branch information
mookums committed Jan 26, 2024
1 parent 105eb06 commit 51d25ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

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

5 changes: 4 additions & 1 deletion src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn open_serial_port(port_state: tauri::State<PortState>, port_name: &str, baud_r
.timeout(Duration::from_millis(5000))
.open();

let new_port = match new_port_result {
let mut new_port = match new_port_result {
Ok(p) => p,
Err(e) => match e.kind {
ErrorKind::NoDevice => return 1,
Expand All @@ -47,6 +47,9 @@ fn open_serial_port(port_state: tauri::State<PortState>, port_name: &str, baud_r
},
};

new_port.write_data_terminal_ready(true).unwrap();
new_port.set_flow_control(serialport::FlowControl::Hardware).unwrap();

// Check the Port State.
let port_guard_result = port_state.port.lock();
match port_guard_result {
Expand Down

0 comments on commit 51d25ec

Please sign in to comment.