Ports
May 21, 2013, 06:02:35 am
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: SMF - Just Installed!
Home
Help
Search
Login
Register
Welcome to the PORTS Forum. Please post your questions, answers, and comments relating to USB and other hardware interfaces in the appropriate forums below. - Jan
Ports
>
General Category
>
USB
>
How do I determine if Windows drivers have loaded
Pages: [
1
]
« previous
next »
Print
Author
Topic: How do I determine if Windows drivers have loaded (Read 862 times)
Virgil Gomes
Member
Posts: 15
How do I determine if Windows drivers have loaded
«
on:
April 16, 2012, 03:56:19 pm »
Hi,
I'm new to USB and need some help. I'm using C# Example code 5.0 as my plateform using OS Win 7.
After I connect a new USB device to my PC, my program detects the device via FindTheHid(), the Windows driver then loads anywhere from 10 to 30 seconds later, the I am able to communicate to my device. I account for this in my code but find it not efficient. Here is the code:
while (!(myDeviceDetected = FindTheHid()) && (attempts < 30))
{
Debug.WriteLine("Can't find the serialized device!");
lstResults.Items.Add(" ....Waiting for device to re-enumerate");
Thread.Sleep(15000); // wait for 15 sec
attempts++;
}
Is there a way to detect that the Windows Driver loaded?
Thank you,
Virgil
Logged
Jan Axelson
Administrator
Frequent Contributor
Posts: 1626
Re: How do I determine if Windows drivers have loaded
«
Reply #1 on:
April 16, 2012, 04:54:33 pm »
If the system has a USB keyboard or mouse, the HID drivers are loaded.
If there is a problem with installing the device, the setupapi log file might offer a clue:
http://support.microsoft.com/kb/927521
Jan
Logged
Virgil Gomes
Member
Posts: 15
Re: How do I determine if Windows drivers have loaded
«
Reply #2 on:
April 17, 2012, 07:20:17 am »
Hi,
I am production testing the same device (PID and VID) with different serial numbers. I install, test, and remove the devices, and on the installation of each of the devices, a driver is loaded every time. The devices are HID. If I start testing before the driver is done loading I will get exceptions. Is there a way to determine if the driver is done loading?
I did look at the link that was suggested and was not able to locate the setupapi.log file.
Thank you,
Virgil
Logged
Virgil Gomes
Member
Posts: 15
Re: How do I determine if Windows drivers have loaded
«
Reply #3 on:
April 17, 2012, 07:21:52 am »
Hi,
I forgot to mention that they system (PC) does have a mouse and keyboard.
Thank you,
Virgil
Logged
Jan Axelson
Administrator
Frequent Contributor
Posts: 1626
Re: How do I determine if Windows drivers have loaded
«
Reply #4 on:
April 17, 2012, 11:21:59 am »
You can find the setupapi log file with Windows search.
In XP:
Start > Search > For Files and Folders > Search companion > All files and folders
In "all or part of the file name", enter setupapi
In "Look in", select the main drive.
One solution is to catch the exception and restart if needed.
If the device is in Device Manager, it should be available. See the WDK for the devcon example that shows how to retrieve the same device information that Device Manager shows.
Jan
«
Last Edit: April 17, 2012, 11:37:29 am by Jan Axelson
»
Logged
Pages: [
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> USB
=> Serial Ports
=> Embedded Ethernet
=> Parallel Port
=> Other Interfaces
=> General Discussion
Loading...