Make DM-1801 images compatible with native CPS.

This commit is contained in:
Serge Vakulenko 2019-08-12 00:14:56 -07:00
parent b60cad10f6
commit f08dd83297
2 changed files with 5 additions and 13 deletions

View File

@ -380,7 +380,7 @@ static void dm1801_download(radio_device_t *radio)
download(radio);
// Add header.
memcpy(&radio_mem[0], "MD-760P", 7);
memcpy(&radio_mem[0], "1801", 4);
}
//
@ -412,7 +412,7 @@ static void dm1801_upload(radio_device_t *radio, int cont_flag)
//
static int dm1801_is_compatible(radio_device_t *radio)
{
return strncmp("MD-760P", (char*)&radio_mem[0], 7) == 0;
return strncmp("1801", (char*)&radio_mem[0], 4) == 0;
}
//

14
radio.c
View File

@ -231,17 +231,9 @@ void radio_read_image(const char *filename)
if (memcmp(ident, "BF-5R", 5) == 0) {
device = &radio_rd5r;
} else if (memcmp(ident, "MD-760P", 7) == 0) {
// Both GD-77 and DM-1801 have the same header.
fseek(img, 0x90, SEEK_SET);
if (fread(ident, 1, 8, img) != 8) {
fprintf(stderr, "%s: Cannot read radio ID.\n", filename);
exit(-1);
}
if (memcmp(ident, "BF-1801", 7) == 0) {
device = &radio_dm1801;
} else {
device = &radio_gd77;
}
device = &radio_gd77;
} else if (memcmp(ident, "1801", 4) == 0) {
device = &radio_dm1801;
} else if (memcmp(ident, "MD-760", 6) == 0) {
fprintf(stderr, "Old Radioddity GD-77 v2.6 image not supported!\n");
exit(-1);