java - How to use usb4java to read two scanners at the same time? -
i have 2 barcode scanners , need read data scanner. how can know data comes scanner? know scanners auto config keyboard , using windows 8.
how can know data comes scanner?
i using following method:
public static string getbusanddevice(final usbdevice usbdevice) { // hack: need "deviceid ((abstractdevice) usbdevice).getid()" it's not accessible! // usbdevice.tostring() gives information, shouldn't rely on // string returned method! final string tostring = usbdevice.tostring(); final matcher matcher = pattern_busanddevice.matcher(tostring); if (!matcher.matches()) { throw new illegalstateexception("can't retrieve 'bus %03d device %03d'"); } final string busanddevice = matcher.group(1); return busanddevice; } static final pattern pattern_busanddevice = pattern.compile( // "^(bus ([0-9]{3}) device ([0-9]{3})): .*");
Comments
Post a Comment