,, can you tell me the Windows API which interface to get the specified USB protocol version and VID, PID, the view on the Internet, many of them are all the USB VID and PID, so not is makes the keyboard and mouse is to find out? I've tried it, it is even the mouse and keyboard to find out, what to do, only to find out their own insert USB VID and PID? The code is as follows:
//# include "stdafx. H"
#include
#include #include #include #include using namespace std; # pragma comment (lib, "setupapi. Lib") X6530 xa5dcbf10l DEFINE_GUID (UsbClassGuid, 0, 0, 0 x11d2, 0 x90, 0 x1f, 0 x00 to 0 xc0, 0 x4f, 0 xb9, 0 x51, 0 xed); //for USB device VID and PID String GetUsbInfo () { HDEVINFO HDEVINFO; SP_DEVICE_INTERFACE_DATA spDevData; PSP_DEVICE_INTERFACE_DETAIL_DATA pDetail; BOOL bRes=TRUE; Int nCount=0; String csResult; HDevInfo=: : SetupDiGetClassDevs ((LPGUID) & amp; UsbClassGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE); If (hDevInfo!=INVALID_HANDLE_VALUE) { PDetail=(PSP_DEVICE_INTERFACE_DETAIL_DATA) : : GlobalAlloc (LMEM_ZEROINIT, 1024); PDetail - & gt; The cbSize=sizeof (SP_DEVICE_INTERFACE_DETAIL_DATA); While (bRes) { SpDevData. CbSize=sizeof (SP_DEVICE_INTERFACE_DATA); BRes=: : SetupDiEnumDeviceInterfaces (hDevInfo, NULL, (LPGUID) & amp; UsbClassGuid nCount, & amp; SpDevData); If (bRes) { BRes=: : SetupDiGetInterfaceDeviceDetail (hDevInfo, & amp; SpDevData, pDetail, 1024, NULL, NULL); If (bRes) { String szStr=pDetail - & gt; DevicePath; CsResult +=szStr + "\ n"; //break; NCount++; } } } : : GlobalFree (pDetail); : : SetupDiDestroyDeviceInfoList (hDevInfo); } Return csResult; } Int main (void) { String csStr=GetUsbInfo (); Cout & lt; Cout & lt; <"The End... "; return 0; } We should be grateful for your kindly understand bosses to give directions!!!!! CodePudding user response:
Read the device descriptor CodePudding user response:
in the WDK USBView source code, can refer to study under the CodePudding user response:
reference 1/f, worldy response: reading device descriptor read, but I don't know the field is the version of the said agreement, like the VID and PID did you find... CodePudding user response:
refer to the second floor zgl7903 response: in the WDK USBView source code, can refer to study under the appreciate, is studying in... CodePudding user response:
DeviceDscr: The db DSCR_DEVICE_LEN;; Descriptor length The db DSCR_DEVICE;; Decriptor type dw 0002 h;; Specification Version (BCD) The db 00 h;; Device class The db 00 h;; Device sub - class The db 00 h;; Device sub - sub - class The db 64;; Maximum packet size Dw 0 b404h;; Vendor ID Dw 0510 h;; The Product ID (Sample Device) Dw 0000 h;; The Product version ID The db 1;; The Manufacturer string index Db 2;; The Product string index The db 0;; Serial number string index The db 1;; The Number of configurations The red fields CodePudding user response:
reference lwei2 reply: 3/f Quote: refer to 1st floor worldy response: reading device descriptor read, but I don't know the field is the version of the said agreement, like the VID and PID did you find... why not STORAGE_DEVICE_DESCRIPTOR this structure, which is as follows: Typedef struct _STORAGE_DEVICE_DESCRIPTOR { ULONG Version;//version ULONG Size;//structure size UCHAR DeviceType;//device type UCHAR DeviceTypeModifier;//- 2 additional SCSI device type BOOLEAN RemovableMedia;//whether mobile BOOLEAN CommandQueueing;//support command queue ULONG VendorIdOffset;//manufacturer value migration ULONG ProductIdOffset;//product ID's offset ULONG ProductRevisionOffset;//product version of the offset ULONG SerialNumberOffset;//the serial number of the offset STORAGE_BUS_TYPE BusType;//bus type ULONG RawPropertiesLength;//additional attributes data length UCHAR RawDeviceProperties [1].//additional attribute data (only defines a symbolic 1 byte) } STORAGE_DEVICE_DESCRIPTOR, * PSTORAGE_DEVICE_DESCRIPTOR; It is as you say, its properties to the custom? CodePudding user response:
https://blog.csdn.net/chenyujing1234/article/details/7577320 CodePudding user response:
reference 5 floor worldy reply: DeviceDscr: The db DSCR_DEVICE_LEN;; Descriptor length The db DSCR_DEVICE;; Decriptor type dw 0002 h;; Specification Version (BCD) The db 00 h;; Device class The db 00 h;; Device sub - class The db 00 h;; Device sub - sub - class The db 64;; nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull