简体   繁体   English

设备路径中的供应商ID和产品ID

[英]Vendor id and product id from device path

I need to get a vendor id and device id from a known device path (like "D:\\"). 我需要从已知设备路径(例如“ D:\\”)中获取供应商ID和设备ID。
I need to do it in java but I could do it in c native code and call the function in java. 我需要在Java中执行此操作,但我可以在c本机代码中执行此操作并在Java中调用该函数。
I've tried some java libraries such as javax.usb however I can't associate a device with it's path. 我试过一些java库,例如javax.usb,但是我无法将设备与其路径关联。 Now I have finished all my ideas. 现在我已经完成了所有想法。 Can someone help me or give me a way to do it? 有人可以帮助我还是给我一种方法? I need it for windows/macOS. 对于Windows / macOS,我需要它。

Have a look at this post . 看一下这个帖子 You'll probably need to use JNA or JNI to interface with the native Windows SetupDi functions to parse through and find device paths that you care about. 您可能需要使用JNA或JNI与本地Windows SetupDi函数进行接口,以解析并找到您关心的设备路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM