Recognize old GD-77 images.

This commit is contained in:
Serge Vakulenko 2018-09-17 17:28:21 -07:00
parent 175516fbcf
commit f4bb02eea2
4 changed files with 30 additions and 5 deletions

View File

@ -49,6 +49,7 @@ static struct {
{ "ZN><:", &radio_rt27d }, // Radtel RT-27D
{ "BF-5R", &radio_rd5r }, // Baofeng RD-5R
{ "MD-760P", &radio_gd77 }, // Radioddity GD-77
{ "MD-760", &radio_gd77_old }, // Radioddity GD-77, older versions up to 2.6.6
{ 0, 0 }
};
@ -202,6 +203,8 @@ void radio_read_image(const char *filename)
device = &radio_rd5r;
} else if (memcmp(ident, "MD-760P", 7) == 0) {
device = &radio_gd77;
} else if (memcmp(ident, "MD-760", 6) == 0) {
device = &radio_gd77_old;
} else {
fprintf(stderr, "%s: Unrecognized header '%.6s'\n",
filename, ident);

View File

@ -124,6 +124,7 @@ extern radio_device_t radio_dp880; // Zastone DP880
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
extern radio_device_t radio_gd77_old; // Radioddity GD-77, older versions up to 2.6.6
//
// Radio: memory contents.

29
rd5r.c
View File

@ -406,12 +406,14 @@ static int rd5r_is_compatible(radio_device_t *radio)
return strncmp("BF-5R", (char*)&radio_mem[0], 5) == 0;
}
//
// Check whether the memory image is compatible with this device.
//
static int gd77_is_compatible(radio_device_t *radio)
{
return strncmp("MD-760P", (char*)&radio_mem[0], 7) == 0;
return strncmp("MD-760", (char*)&radio_mem[0], 7) == 0;
}
static int gd77old_is_compatible(radio_device_t *radio)
{
return strncmp("MD-760", (char*)&radio_mem[0], 6) == 0;
}
//
@ -2278,3 +2280,22 @@ radio_device_t radio_gd77 = {
rd5r_parse_row,
rd5r_update_timestamp,
};
//
// Radioddity GD-77, older versions up to 2.6.6
//
radio_device_t radio_gd77_old = {
"Radioddity GD-77 (old)",
gd77_download,
rd5r_upload,
gd77old_is_compatible,
rd5r_read_image,
rd5r_save_image,
rd5r_print_version,
rd5r_print_config,
rd5r_verify_config,
rd5r_parse_parameter,
rd5r_parse_header,
rd5r_parse_row,
rd5r_update_timestamp,
};

2
util.c
View File

@ -256,7 +256,7 @@ void print_ascii(FILE *out, const unsigned char *text, unsigned nchars, int fill
ch = *text++;
if (ch == '\t')
ch = ' ';
if (nchars <= 16 && ch == ' ')
if (fill_flag && ch == ' ')
ch = '_';
putc(ch, out);
}