How to communicate with a USB device under Windows

2019-01-17 04:12发布

I'd like to communicate with a USB device under Windows and Java but I can't find a good library to do so. I don't want the user to have to install any extra hardware or device drivers to make this work. That is, I want to be able to interact with USB just like other Windows applications do.

I am familiar with jUSB and JSR 80 but both seem to be dead projects (at least for Windows).

标签: java windows usb
4条回答
可以哭但决不认输i
2楼-- · 2019-01-17 04:33

I did quite a bit of research on this some time ago, and the unfortunate fact was that all the useful free USB+Windows+Java projects were dead. There is commercial and expensive (price $39.99 is not per developer, but per copy of your software sold!) JCommUSB library which probably works, although I have no experience of it; we had to build our own custom C wrappers to the USB drivers and communicate with them through JNI.

查看更多
相关推荐>>
3楼-- · 2019-01-17 04:37

libusb-win32 requires you to install their generic driver, which then makes a USB device available to you. I'm not sure that it's possible to do driver-less access of an USB device unless the device belongs to one of several standard classes (storage and HID, in particular).

There is a Java wrapper for libusb-win32 which might work for you. I haven't used it myself, though.

查看更多
狗以群分
4楼-- · 2019-01-17 04:37

Communication between Windows and a USB device by java. http://javausbapi.blogspot.com/2010/05/java-usb-api.html

An example is conducted for a Freescale microcontroller

查看更多
家丑人穷心不美
5楼-- · 2019-01-17 04:47

The fastest and easiest way is to hack some native code :) I wrote a small wrapper for HID devices that enabled my Java applications to read data from CalComp digitizers, so it's definitely doable and not too hard. The bad thing is that my work is still proprietary code owned by my former employer, so for legal reasons I can't release that as open-source -- yet.

The good thing is that you can get a flying start with the HID example code from the Microsoft DDK :)

查看更多
登录 后发表回答