X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=libaltos%2Flibaltos_windows.c;h=43e347c40cb70ce96bb0bbf9dd19875a6e551881;hb=c4708930ebfbc056bb4faae9b23720d3be401978;hp=0c1f6782fd58f167be01d53a112dede4d04a426f;hpb=4e07392c65ec512e3309d89c7465c1406a941b66;p=fw%2Faltos diff --git a/libaltos/libaltos_windows.c b/libaltos/libaltos_windows.c index 0c1f6782..43e347c4 100644 --- a/libaltos/libaltos_windows.c +++ b/libaltos/libaltos_windows.c @@ -132,12 +132,13 @@ altos_ftdi_list_start(void) } static struct { - char *windows; - char *real; + unsigned int vid, pid; + char *name; } name_map[] = { - { .windows = "AltusMetrum28", .real = "EasyMega" }, - { .windows = "AltusMetrum2c", .real = "EasyMotor" }, - { 0, 0 }, + { .vid = 0xfffe, .pid = 0x000d, .name = "EasyTimer" }, + { .vid = 0xfffe, .pid = 0x0028, .name = "EasyMega" }, + { .vid = 0xfffe, .pid = 0x002c, .name = "EasyMotor" }, + { .name = NULL }, }; PUBLIC int @@ -240,11 +241,22 @@ altos_list_next(struct altos_list *list, struct altos_device *device) altos_set_last_windows_error(); continue; } - for (i = 0; name_map[i].windows; i++) - if (!strcmp(name_map[i].windows, friendlyname)) { - strcpy(friendlyname, name_map[i].real); + + char *space = friendlyname; + while (*space) { + if (*space == ' ') { + *space = '\0'; break; } + space++; + } + + for (i = 0; name_map[i].name; i++) { + if (name_map[i].vid == vid && name_map[i].pid == pid) { + strcpy(friendlyname, name_map[i].name); + break; + } + } device->vendor = vid; device->product = pid;