0

We are developing a java web application and it must read barcodes. We are using a barcode reader called Gryphon and it works properly. We are able to read barcodes from Java. We are using RXTX API (similar to JAVACOMM).

But what we would like to know is how to get the device name connected to the RS232 port. If the computer of a user had several devices connected to different RS232 ports, we only want to listen on the port where barcode reader is connected. How could we distinguish which is the device connected in each RS232 port?

With the next code I only get the port names (COM1, COM3, COM5, ...)

Enumeration<CommPortIdentifier> pp= CommPortIdentifier.getPortIdentifiers();
while (pp.hasMoreElements())
{
    System.out.println (pp.nextElement().getName());
}

I would like to obtain something like "Gryphon" or "Serial Port for Barcode Scanner".

Thanks

Eduardo
  • 1,169
  • 5
  • 21
  • 56
  • RS232 ports (i.e. UARTs and USARTs) are not self-identifying to their host or over the serial link. If you do not have modem control lines (e.g. a 3-wire connection), then the host cannot reliably determine if any device is even connected. There is simply no method of testing serial ports for a particular device, especially because the probe would disrupt an active serial connection or send unwanted data to each connected device. The typical method is for the user to explicitly specify the port of the attached device. – sawdust Oct 28 '14 at 19:38
  • possible duplicate of [Get the device name connected to the serial port](http://stackoverflow.com/questions/4500027/get-the-device-name-connected-to-the-serial-port) – sawdust Oct 29 '14 at 07:12
  • Thanks for your reply. I had read the link you have told me, but I wanted to be sure that there was not a solution. – Eduardo Oct 29 '14 at 08:11
  • If you're using a USB to serial converter, it may be possible to determine what is plugged in based on the brand. For example, FTDI chips allow you to program the description/manufacturer string, which you can get through FTDI's D2XX driver. There's also some way to get this information through Windows directly, but I don't know what that is. – rm5248 Nov 01 '14 at 03:53

0 Answers0