ssmnarendra / java-simple-serial-connector

Automatically exported from code.google.com/p/java-simple-serial-connector
0 stars 0 forks source link

TIOCEXCL on Linux #24

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. run your app as user (not root)
2. call getPortNames on Linux
3. try to open any port

What is the expected output? What do you see instead?
Obviously I'd expect the port to be opened, however I get a "port busy".

What version of the product are you using? On what operating system?
This is running on Ubuntu 12.04 LTS.

The issue seems to be that getPortNames (calling getLinuxPortNames) is opening 
the port. When opening the port on Linux, jssc currently issues a TIOCEXCL 
which is never cleared, so remains active after a close ... preventing jssc 
itself to open the port again.

Reproducable by this C program:

  int f = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY | O_NDELAY);
  if (f != -1) {
    ioctl(f, TIOCEXCL);
    close(f);
  } else {
    printf("could not open port\n");
  }

Just run it twice.

Original issue reported on code.google.com by dan...@dseifert.de on 5 Dec 2012 at 6:54

GoogleCodeExporter commented 8 years ago
Fixed in 2.1.0

Original comment by scream3r.org@gmail.com on 11 Apr 2013 at 2:31