Reputation:
Looking for a way to read the unique ID / serial# of a USB thumb drive;
please note that
- I am looking for the value of the manufacturer, not the one Windows allocates for it.
- I need to support multiple OS (Windows, Unix, Mac), thus needs to be a Java solution
The idea is to be able to distinguish between different USB thumb drives.
Upvotes: 8
Views: 5588
Reputation: 171084
I've never tried using it (it's been on my todo list for a good few months now), but there is the "marge" project on java.net:
This should let you connect to bluetooth devices (although I don't think it is 100% feature complete, there is demo code on there), and then the ClientDevice class has a "getBluetoothAddress" method which I believe should be unique to that device
http://marge.java.net/javadoc/v06/marge-core/net/java/dev/marge/entity/ClientDevice.html
As I say though, I've never tried it...
Upvotes: 2
Reputation: 4777
You might give a look at the following projects: javax-usb and jusb. They seem to support Linux and Windows.
Anyway, since USB access in Java requires the use of native libraries, you might not achieve the required portability.
Upvotes: 2
Reputation: 1002
RXTX is the way to go. In the world of model trains, JMRI (Java Model Railroad Interface) has become very popular. JMRI runs on all platforms (Windows, Linux and Mac) and communicates with a variety of USB based devices (command stations). RXTX is in fact used by JMRI.
Upvotes: 3