// check if we can open a port with the given name
int fd = jtermios.JTermios.open(portName, O_RDWR | O_NOCTTY | O_NONBLOCK);
if (fd != -1) {
// yep, it exists, now check to see if it's really a serial
// port
if (tcgetattr(fd, new Termios()) != -1 || errno() != ENOTTY) {
jtermios.JTermios.close(fd);
return new CommPortIdentifier(portName, PORT_SERIAL,
null);
} else {
// Not a serial port, or we can't access it