projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update configure.ac for 1.9.6 release
[fw/altos]
/
libaltos
/
libaltos_windows.c
diff --git
a/libaltos/libaltos_windows.c
b/libaltos/libaltos_windows.c
index 4f9f18075e02c9744a6f6509ce6a9bcd6567e7d4..b92df70857fb03b1bbf61220cd91608eb307051d 100644
(file)
--- a/
libaltos/libaltos_windows.c
+++ b/
libaltos/libaltos_windows.c
@@
-131,6
+131,15
@@
altos_ftdi_list_start(void)
return list;
}
return list;
}
+static struct {
+ unsigned int vid, pid;
+ char *name;
+} name_map[] = {
+ { .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)
{
PUBLIC int
altos_list_next(struct altos_list *list, struct altos_device *device)
{
@@
-148,6
+157,7
@@
altos_list_next(struct altos_list *list, struct altos_device *device)
DWORD friendlyname_len;
char instanceid[1024];
DWORD instanceid_len;
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,
dev_info_data.cbSize = sizeof (SP_DEVINFO_DATA);
while(SetupDiEnumDeviceInfo(list->dev_info, list->index,
@@
-230,6
+240,23
@@
altos_list_next(struct altos_list *list, struct altos_device *device)
altos_set_last_windows_error();
continue;
}
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;
device->vendor = vid;
device->product = pid;
device->serial = serial;
@@
-639,7
+666,7
@@
static void
ba2str(BTH_ADDR ba, char *str)
{
ba2str(BTH_ADDR ba, char *str)
{
- sprintf(str, "%02
x:%02x:%02x:%02x:%02x:%02x
",
+ sprintf(str, "%02
X:%02X:%02X:%02X:%02X:%02X
",
get_byte(ba, 0),
get_byte(ba, 1),
get_byte(ba, 2),
get_byte(ba, 0),
get_byte(ba, 1),
get_byte(ba, 2),
@@
-755,8
+782,14
@@
altos_bt_open(struct altos_bt_device *device)
altos_set_last_winsock_error();
closesocket(file->socket);
free(file);
altos_set_last_winsock_error();
closesocket(file->socket);
free(file);
+ log_message("Connection attempted to address %s port %d\n", device->addr, sockaddr_bth.port);
return NULL;
}
return &file->file;
}
return NULL;
}
return &file->file;
}
+void
+altos_pause_one_second(void)
+{
+ Sleep(1000);
+}