tags:

views:

1870

answers:

4

Looking for a way to read the unique ID / serial# of a USB thumb drive; please note that - I am looking for the value that the manufacturer's value, not the one Windows allocates for it - need to support multiple OSs (Windows, Unix, Mac), thus needs to be a Java solution

the idea is to be able to distinguish between different USB thumb drives.

+2  A: 

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:

https://marge.dev.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

https://marge.dev.java.net/javadoc/v05/net/java/dev/marge/entity/ClientDevice.html

As I say though, I've never tried it...

tim_yates
+1  A: 

I have never investigated this thoroughly, but from memory the RXTX library implementation of the javax.comm packages are supposedly very good and now have USB support.

Aidos
+2  A: 

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.

Rangachari Anand
+1  A: 

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.

jassuncao