简体   繁体   中英

Python script to detect USBs in java GUI

I'm making a java GUI application (javafx) that calls a python script (python2.7) which detects connected devices. The reason for this is so I can automate my connections with multiple devices.

In my python script, I use pyusb. However to detect a device, I have to use inf_wizard.exe from libusb-win32 to communicate with the device. This is fine for my own development and debugging, but what happens if I wish to deploy this app and have other users use this?

Would this app, on another computer, be able to detect a device?

Thanks

Please let me know if there is a better way to doing this.

No, in most (Windows) scenarios this will not work. The problem is that libusb on Windows uses a special backend (libusb0.sys, libusbK.sys or winusb.sys). You have to install one of those backends (libusb-win32 is libusb0.sys) on every machine you want your software to run on. Under Linux this should work fine out of the box.

Essentially you have to ship the files you generate with inf_wizard.exe with your software and install the inf (needs elevated privileges) before you can use the device with your software.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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