(serialdev: &str, command: Command, args: &[u8])
| 397 | } |
| 398 | |
| 399 | fn simple_cmd(serialdev: &str, command: Command, args: &[u8]) { |
| 400 | let port_result = serialport::new(serialdev, 115_200) |
| 401 | .timeout(SERIAL_TIMEOUT) |
| 402 | .open(); |
| 403 | |
| 404 | match port_result { |
| 405 | Ok(mut port) => simple_cmd_port(&mut port, command, args), |
| 406 | Err(error) => match error.kind { |
| 407 | serialport::ErrorKind::Io(std::io::ErrorKind::PermissionDenied) => panic!("Permission denied, couldn't access inputmodule serialport. Ensure that you have permission, for example using a udev rule or sudo."), |
| 408 | other_error => panic!("Couldn't open port: {:?}", other_error) |
| 409 | } |
| 410 | }; |
| 411 | } |
| 412 | |
| 413 | fn open_serialport(serialdev: &str) -> Box<dyn SerialPort> { |
| 414 | serialport::new(serialdev, 115_200) |
no test coverage detected