-
Notifications
You must be signed in to change notification settings - Fork 34
Open
Description
See the attached image with debug log enabled.
Retrieving VID & PID seems to be broken. On Windows XP SP3 it works well.
BTW I'm running Windows 10 in Parallels. The device is bridged from the host machine.
And the binary is generated by i686-mingw32-w64 cross compiler.
Code is like:
ret = sp_list_ports(&ports);
if (ret != SP_OK)
return -1;
for (i = 0; ports[i]; i++) {
int n, vid, pid;
char sn[16];
int ubus, uadd;
ret = sp_get_port_usb_vid_pid(ports[i], &vid, &pid);
if (ret != SP_OK)
continue;
ret = sp_get_port_usb_bus_address(ports[i], &ubus, &uadd);
if (ret == SP_OK)
sprintf(sn, "%04x:%04x", ubus, uadd);
else
strcpy(sn, "<unknown>");
printf("vid=%04x&pid=%04x\n", vid, pid);
for (n = 0; n < sizeof(g_models) / sizeof(g_models[0]); n++) {
if (g_models[n].vid != vid ||
g_models[n].pid != pid)
continue;
printf("[%s][+] detected model: %s.\n", sn, g_models[n].name);
fflush(stdout);
ret = sp_open(ports[i], SP_MODE_READ_WRITE);
if (ret != SP_OK) {
printf("[%s][-] failed to open port.\n", sn);
fflush(stdout);
continue;
}
ret = sp_setup(ports[i]);
if (ret < 0) {
printf("[%s][-] failed to configurate port.\n", sn);
fflush(stdout);
goto bail;
}
sp_close(ports[i]);
}
}
sp_free_port_list(ports);
return 0;
giuliomarin
Metadata
Metadata
Assignees
Labels
No labels