Use static radio_device_t vars

This commit is contained in:
Greg Shuflin 2021-03-01 02:29:53 -08:00
parent c921cc54d6
commit ea9ff0a534
2 changed files with 43 additions and 0 deletions

View File

@ -19,6 +19,22 @@ fn main() {
// included header files changed.
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
.whitelist_type("radio_device_t")
.whitelist_var("radio_md380")
.whitelist_var("radio_md390")
.whitelist_var("radio_md201")
.whitelist_var("radio_uv380")
.whitelist_var("radio_uv390")
.whitelist_var("radio_md960")
.whitelist_var("radio_d900;")
.whitelist_var("radio_dp8")
.whitelist_var("radio_rt27d")
.whitelist_var("radio_rd5")
.whitelist_var("radio_gd77;")
.whitelist_var("radio_dm180")
.whitelist_var("radio_d868u")
.whitelist_var("radio_d878u")
.whitelist_var("radio_dmr6x")
.whitelist_var("radio_rt84")
.blacklist_type("FILE")
// Finish the builder and generate the bindings.
.generate()

View File

@ -191,6 +191,33 @@ pub fn verify_config(radio: &Radio) {
/// Read firmware image from the binary file.
pub fn read_image(filename: &str) -> Radio {
/*
eprintln!"Read codeplug from file '{}'.", filename);
let img = std::fs::File::open(filename).unwrap();
let metadata = std::fs::metadata(filename).unwrap();
let file_size = metadata.len();
match file_size {
851968 | 852533 => {
}
262144 | 262709 => {
}
1606528 => {
}
131072 => {
}
size => {
eprintln!("{}: Unrecognized file size {} bytes.", filename, size);
exit(-1);
}
};
*/
let filename = CString::new(filename.to_string()).unwrap();
let ptr = unsafe {
radio_read_image(filename.as_ptr())