radio::upload

This commit is contained in:
Greg Shuflin 2021-02-28 02:38:07 -08:00
parent cd74a703c1
commit 863f14b0c2
2 changed files with 9 additions and 9 deletions

View File

@ -7,9 +7,6 @@ mod radio;
const COPYRIGHT: &'static str = "Copyright (C) 2018 Serge Vakulenko KK6ABQ";
const VERSION: Option<&'static str> = option_env!("VERSION");
extern {
fn radio_upload(cont_flag: c_int);
}
fn print_usage() {
let version = VERSION.unwrap_or("-----");
@ -91,13 +88,11 @@ pub extern "C" fn rust_main(_argc: c_int, _argv: *const *const c_char) -> c_int
if matches.free.len() != 1 {
print_usage();
}
unsafe {
let device = radio::connect();
radio::read_image(&matches.free[0]);
radio::print_version(device);
radio_upload(0);
radio::upload(device, 0);
radio::disconnect();
}
} else if config_flag {
let conf_args = matches.free.len();
if !(conf_args == 1 || conf_args == 2) {
@ -119,17 +114,15 @@ pub extern "C" fn rust_main(_argc: c_int, _argv: *const *const c_char) -> c_int
radio::save_image("device.img");
} else {
// Update device from text config file.
unsafe {
let device = radio::connect();
radio::download(device);
radio::print_version(device);
radio::save_image("device.img");
radio::parse_config(&config_filename);
radio::verify_config();
radio_upload(1);
radio::upload(device, 1);
radio::disconnect();
}
}
} else if verify_flag {
if matches.free.len() != 1 {
print_usage();

View File

@ -9,6 +9,7 @@ extern {
fn radio_connect() -> *const RadioDeviceT;
fn radio_disconnect();
fn radio_download(device: *const RadioDeviceT);
fn radio_upload(cont_flag: c_int);
fn radio_list_c();
fn radio_verify_config();
fn radio_print_version(device: *const RadioDeviceT, stdout: *const libc::FILE);
@ -37,6 +38,12 @@ pub fn download(device: *const RadioDeviceT) {
}
}
pub fn upload(_device: *const RadioDeviceT, cont_flag: c_int) {
unsafe {
radio_upload(cont_flag)
}
}
pub fn list() {