22 #define snprintf _snprintf 37 "URG Series USB Device Driver",
38 "URG-X002 USB Device Driver",
47 if (from_index == to_index) {
80 GUID GUID_DEVINTERFACE_COM_DEVICE = {
81 0x4D36E978L, 0xE325, 0x11CE,
82 {0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 }
86 SP_DEVINFO_DATA sDevInfo;
90 hdi = SetupDiGetClassDevs(&GUID_DEVINTERFACE_COM_DEVICE, 0, 0,
91 DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
92 if (hdi == INVALID_HANDLE_VALUE) {
96 sDevInfo.cbSize =
sizeof(SP_DEVINFO_DATA);
97 for (i = 0; SetupDiEnumDeviceInfo(hdi, i, &sDevInfo); ++i){
101 ComNameLengthMax = 7,
103 char buffer[BufferSize + 1];
112 SetupDiGetDeviceRegistryPropertyA(hdi, &sDevInfo, SPDRP_FRIENDLYNAME,
113 &dwRegType, (BYTE*)buffer, BufferSize,
115 n = (int)strlen(buffer);
116 if (n < ComNameLengthMax) {
123 p = strrchr(buffer,
')');
129 p = strstr(&buffer[n - ComNameLengthMax],
"COM");
137 SetupDiGetDeviceRegistryPropertyA(hdi, &sDevInfo, SPDRP_DEVICEDESC,
138 &dwRegType, (BYTE*)buffer, BufferSize,
142 for (j = 0; j < n; ++j) {
151 SetupDiDestroyDeviceInfoList(hdi);
static void sort_ports(void)
static char * search_driver_names[]
const char * urg_serial_port_name(int index)
検索したシリアルポート名を返す
int urg_serial_is_urg_port(int index)
ポートが URG かどうか
static void swap_item(int from_index, int to_index)
static int found_ports_size
int urg_serial_find_port(void)
シリアルポートを検索する
static int is_urg_ports[MAX_PORTS]
static char found_ports[MAX_PORTS][DEVICE_NAME_SIZE]