How to get the SERIALNUMBER of a USB Device connected to my laptop on Windows OS ? #2667
Replies: 2 comments 7 replies
-
OSHI includes serial numbers in the listing of USB Devices if they are available. It navigates the device tree (see https://github.com/oshi/oshi/blob/master/oshi-core/src/main/java/oshi/driver/windows/DeviceTree.java) which calls the native SetupDiGetClassDevs function on Windows to list the devices and CM_Get_DevNode_Registry_Property to look up their properties. There is no indication in those APIs that any special permissions are required. All the information they fetch is also available in the registry. How are you collecting the serial number in your own program? |
Beta Was this translation helpful? Give feedback.
-
Thanks for the clarification and example. As I understand when you run OSHI from within Eclipse it performs as expected, but when you are running it from a console it does not? I'm really not sure here, this seems to possibly be some permissions restrictions that Windows has in its Console, and not really anything associated with OSHI itself. |
Beta Was this translation helpful? Give feedback.
-
I am using OSHI version 6.2.2. If I run a short program in my Eclipse IDE, it is capable of collecting the SERIAL NUMBER of a USB Camera attached to my laptop. On the other hand, if I create an independent artifact and run it in a DOS console, I am NOT able to get the SERIAL NUMBER.
How can I give OSHI credentials or authorization to collect the serial number of the USB Camera attached?
Beta Was this translation helpful? Give feedback.
All reactions