X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=libaltos%2Flibaltos_windows.c;h=43e347c40cb70ce96bb0bbf9dd19875a6e551881;hb=c4708930ebfbc056bb4faae9b23720d3be401978;hp=846e2217b4c7799ec155cd9870264eb798165b77;hpb=ee79a205e118ea8730a02cc327d8fb79cc5f74ff;p=fw%2Faltos diff --git a/libaltos/libaltos_windows.c b/libaltos/libaltos_windows.c index 846e2217..43e347c4 100644 --- a/libaltos/libaltos_windows.c +++ b/libaltos/libaltos_windows.c @@ -131,6 +131,16 @@ altos_ftdi_list_start(void) return list; } +static struct { + unsigned int vid, pid; + char *name; +} name_map[] = { + { .vid = 0xfffe, .pid = 0x000d, .name = "EasyTimer" }, + { .vid = 0xfffe, .pid = 0x0028, .name = "EasyMega" }, + { .vid = 0xfffe, .pid = 0x002c, .name = "EasyMotor" }, + { .name = NULL }, +}; + PUBLIC int altos_list_next(struct altos_list *list, struct altos_device *device) { @@ -148,6 +158,7 @@ altos_list_next(struct altos_list *list, struct altos_device *device) DWORD friendlyname_len; char instanceid[1024]; DWORD instanceid_len; + int i; dev_info_data.cbSize = sizeof (SP_DEVINFO_DATA); while(SetupDiEnumDeviceInfo(list->dev_info, list->index, @@ -230,6 +241,23 @@ altos_list_next(struct altos_list *list, struct altos_device *device) altos_set_last_windows_error(); continue; } + + 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; device->serial = serial; @@ -760,3 +788,9 @@ altos_bt_open(struct altos_bt_device *device) } return &file->file; } + +void +altos_pause_one_second(void) +{ + Sleep(1000); +}