diff --git a/d868uv.c b/d868uv.c index 073821f..478139a 100644 --- a/d868uv.c +++ b/d868uv.c @@ -659,7 +659,11 @@ static void d868uv_upload(radio_device_t *radio, int cont_flag) // static int d868uv_is_compatible(radio_device_t *radio) { - return strncmp("D868UVE", (char*)&radio_mem[0], 7) == 0; + if (memcmp("D868UVE", (char*)&radio_mem[0], 7) == 0) + return 1; + if (memcmp("D6X2UV", (char*)&radio_mem[0], 6) == 0) + return 1; + return 0; } static void print_id(FILE *out, int verbose) @@ -2623,7 +2627,7 @@ static int d868uv_verify_config(radio_device_t *radio) } // -// TYT MD-UV380 +// Anytone AT-D868UV // radio_device_t radio_d868uv = { "Anytone AT-D868UV", @@ -2641,3 +2645,23 @@ radio_device_t radio_d868uv = { d868uv_update_timestamp, //TODO: d868uv_write_csv, }; + +// +// BTECH DMR-6x2 +// +radio_device_t radio_dmr6x2 = { + "BTECH DMR-6x2", + d868uv_download, + d868uv_upload, + d868uv_is_compatible, + d868uv_read_image, + d868uv_save_image, + d868uv_print_version, + d868uv_print_config, + d868uv_verify_config, + d868uv_parse_parameter, + d868uv_parse_header, + d868uv_parse_row, + d868uv_update_timestamp, + //TODO: d868uv_write_csv, +}; diff --git a/radio.c b/radio.c index 0fc9e38..b27a749 100644 --- a/radio.c +++ b/radio.c @@ -47,6 +47,7 @@ static struct { { "BF-5R", &radio_rd5r }, // Baofeng RD-5R, TD-5R { "MD-760P", &radio_gd77 }, // Radioddity GD-77, version 3.1.1 and later { "D868UVE", &radio_d868uv }, // Anytone AT-D868UV + { "D6X2UV", &radio_dmr6x2 }, // BTECH DMR-6x2 { "ZD3688", &radio_d900 }, // Zastone D900 { "TP660", &radio_dp880 }, // Zastone DP880 { "ZN><:", &radio_rt27d }, // Radtel RT-27D @@ -201,7 +202,20 @@ void radio_read_image(const char *filename) device = &radio_md380; break; case 1606528: - device = &radio_d868uv; + if (fread(ident, 1, 8, img) != 8) { + fprintf(stderr, "%s: Cannot read header.\n", filename); + exit(-1); + } + fseek(img, 0, SEEK_SET); + if (memcmp(ident, "D868UVE", 7) == 0) { + device = &radio_d868uv; + } else if (memcmp(ident, "D6X2UV", 6) == 0) { + device = &radio_dmr6x2; + } else { + fprintf(stderr, "%s: Unrecognized header '%.6s'\n", + filename, ident); + exit(-1); + } break; case 131072: if (fread(ident, 1, 8, img) != 8) { diff --git a/radio.h b/radio.h index 99f8582..60d27cf 100644 --- a/radio.h +++ b/radio.h @@ -125,6 +125,7 @@ extern radio_device_t radio_rt27d; // Radtel RT-27D extern radio_device_t radio_rd5r; // Baofeng RD-5R extern radio_device_t radio_gd77; // Radioddity GD-77, version 3.1.1 and later extern radio_device_t radio_d868uv; // Anytone AT-D868UV +extern radio_device_t radio_dmr6x2; // BTECH DMR-6x2 // // Radio: memory contents.