Programming/C Win32 MFC

win32 usb class

구차니 2017. 11. 3. 16:25

GetRawInputDeviceInfo()를 통해서 받아오니..

이름이 내가 기대했던 device description이 아니라.. 식별자에 가까운 녀석이 나온다 -_-a

nResult = GetRawInputDeviceInfo(pRawInputDeviceList[i].hDevice, // Device

RIDI_DEVICENAME,                // Get Device Name

wcDeviceName,                   // Get Name!

&nBufferSize);


str.Format(_T("%s"),wcDeviceName);

\\?\HID#VID_060B&PID_6220&MI_00#7&3275dfb8&0&0000#{884b96c3-56ef-11d1-bc8c-00a0c91405dd}



[링크 : https://stackoverflow.com/questions/36453082/c-winapi-get-list-of-all-connected-usb-devices]

[링크 : https://oroboro.com/usb-serial-number/]

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms645597(v=vs.85).aspx]

[링크 : https://msdn.microsoft.com/ko-kr/library/windows/desktop/ms645598(v=vs.85).aspx]



+

2017.11.05

내가 원하는 항목이 bus reported device description 인 듯?

[링크 : http://searchingforbit.blogspot.com/2014/05/winusb-communication-with-stm32-round-2.html]


        if (SetupDiGetDeviceRegistryProperty (hDevInfo, &DeviceInfoData, SPDRP_DEVICEDESC,

                                              &dwPropertyRegDataType, (BYTE*)szDesc,

                                              sizeof(szDesc),   // The size, in bytes

                                              &dwSize))

            _tprintf (TEXT("    Device Description: \"%s\"\n"), szDesc);


            if (fn_SetupDiGetDevicePropertyW (hDevInfo, &DeviceInfoData, &DEVPKEY_Device_BusReportedDeviceDesc,

                                              &ulPropertyType, (BYTE*)szBuffer, sizeof(szBuffer), &dwSize, 0))

                _tprintf (TEXT("    Bus Reported Device Description: \"%ls\"\n"), szBuffer); 


[링크 : https://stackoverflow.com/questions/3438366/setupdigetdeviceproperty-usage-example]

   [링크 : https://stackoverflow.com/.../how-to-retrieve-bus-reported-device-description-from-arriving-usb-device]


SetupDiGetDeviceProperty function

[링크 : https://msdn.microsoft.com/en-us/library/windows/hardware/ff551963(v=vs.85).aspx]

SetupDiGetDeviceRegistryProperty function

[링크 : https://msdn.microsoft.com/en-us/library/windows/hardware/ff551967(v=vs.85).aspx]