Electronic Components Datasheet Search |
|
AN197 Datasheet(PDF) 9 Page - Silicon Laboratories |
|
AN197 Datasheet(HTML) 9 Page - Silicon Laboratories |
9 / 14 page AN197 Rev. 0.6 9 7.2. Windows 98 SE Alternatively, to find the port number in Windows 98 SE the corresponding key listed above needs to be opened. This is also done using several registry calls using Windows API functions. This key is not directly entered using the VID, PID, and serial number. Instead, each time a new device appears it is enumerated and stored in the registry. So two lookups have to be performed: one to determine if the current key in question contains the VID, PID and serial number needed, and another to actually determine the port number if the VID, PID, and serial number match from the previous lookup. The function is passed the VID, PID, and serial number, and the return value is either the port number that the CP210x is located on, or a –1 if there is a failure. Here is the function to find the CP210x port number in Windows 98 (this function can be copied straight into application code that needs to discover the COM port number): int GetPortNum98(WORD vid, WORD pid, char* ser) { // Variables used for Registry access HKEY tmpKey; CString portKeyString, serKeyString; int serialIndex; DWORD valtype; char* portString; DWORD length = 100; portString = new char[101]; // Set portnum to -1, so if there is an error we will // know by returning a negative port value int portNum = -1; // We will search through the keys by index, starting at 0 // Use this index in the key "Enum\SLABCR\guid\XXXX" serialIndex = 0; serKeyString.Format("Enum\\SLABCR\\guid\\%.4d", serialIndex); // Loop through and convert the serial string to all upper case and replace spaces // for Win98 int i = 0; while (ser[i] != '\0') { if (ser[i] == 0x20) ser[i] = '_'; else if ((ser[i] >= 0x61) && (ser[i] <= 0x7A)) ser[i] -= 32; i++; } // The portkey string should look like this when we query the CLowerDeviceID // "USB\VID_XXXX&PID_XXXX&MI_00\\XXXX_00" where the XXXX's are Vid, Pid and serial // string portKeyString.Format("USB\\VID_%04X&PID_%04X&MI_00\\%s_00", vid, pid, ser); // Open keys to get to the key where the port number is located. This key is: // HKLM\Enum\SLABCR\guid\XXXX\Portname is the key and we will loop through each key // in the registry while (ERROR_SUCCESS == RegOpenKey(HKEY_LOCAL_MACHINE, serKeyString, &tmpKey)) { // Determine the status of the call DWORD status = RegQueryValueEx(tmpKey, "CRLowerDeviceID", NULL, &valtype, (unsigned char *)portString, &length); |
Similar Part No. - AN197 |
|
Similar Description - AN197 |
|
|
Link URL |
Privacy Policy |
ALLDATASHEET.NET |
Does ALLDATASHEET help your business so far? [ DONATE ] |
About Alldatasheet | Advertisement | Contact us | Privacy Policy | Link Exchange | Manufacturer List All Rights Reserved©Alldatasheet.com |
Russian : Alldatasheetru.com | Korean : Alldatasheet.co.kr | Spanish : Alldatasheet.es | French : Alldatasheet.fr | Italian : Alldatasheetit.com Portuguese : Alldatasheetpt.com | Polish : Alldatasheet.pl | Vietnamese : Alldatasheet.vn Indian : Alldatasheet.in | Mexican : Alldatasheet.com.mx | British : Alldatasheet.co.uk | New Zealand : Alldatasheet.co.nz |
Family Site : ic2ic.com |
icmetro.com |