Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to access information in Windows Device Manager from Java?

I have a serial to USB device and more than one of those can be connected to the computer. I need to query and retrieve a list of COM ports that the devices are connected to. In Windows Device Manager you can get the COM port + friendly name of devices that are connected at the present time. This list is dynamic.

Reading from the registry did not work because the information stored is stale and static, not dynamic.

Devcon (from Microsoft) does list the ports that devices are connected to, but it cannot be used in my app because it is not re-distributable.

Any ideas or preferably, a solution?

like image 342
likejudo Avatar asked Mar 12 '13 21:03

likejudo


People also ask

How to get to device Manager?

Android Device Manager website – Visit google.com/android/devicemanager and log in with the same Google account that your missing Android device is signed into.

What does user do with device Manager?

Device Manager displays a graphical view of the hardware that is installed on your computer. Use this tool when you want to view and manage hardware devices and their drivers.

How to check devices on Windows 7?

Click the Start button located on the far left of the Taskbar. Right-click Computer. Left-click Properties. Device Manager will display in the menu.


1 Answers

I had to solve a similar issue just some weeks ago. I came accross the Jawin-Project that provided everything you need to use WMI-Queries. It is already quite old but works like a charm if you follow the documentation. A nice German walkthrough can be found codegods blog.

For me, it did not solve all problems (I had some very specific things to find out about the target device), I finally created an own JNI (Java Native Interface) Class and DLL in C incorporating the windows API.

I hope this is what you searched for.

like image 184
zero0 Avatar answered Oct 19 '22 14:10

zero0