fu-tyan / java-simple-serial-connector

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

Port busy when opening serial port on Ubuntu Linux 12.04 LTS #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

serialPort = new SerialPort("/dev/ttyUSB0");

the actual usb port name is retrieved in the program via 

String[] portNames = SerialPortList.getPortNames();

which returns the correct port.

What is the expected output? What do you see instead?

jssc.SerialPortException: Port name - /dev/ttyUSB0; Method name - openPort(); 
Exception type - Port busy.
    at jssc.SerialPort.openPort(SerialPort.java:146)

What version of the product are you using? On what operating system?
libjSSC-0.9_X86_64.so, ubuntu linux 64 bit 12.04 LTS, running as normal user 
not root.

Please provide any additional information below.

Code is working fine under windows 7 (64bit) with same USB to serial adapter.
(belkin fsu103v)
I've tried reconnecting the usb/serial adapter with no effect, tried rebooting 
system no effect.

Original issue reported on code.google.com by cybor...@gmail.com on 18 Aug 2012 at 2:18

GoogleCodeExporter commented 9 years ago
To solve this problem you must either run the program as root, add the current 
user to the group that /dev/ttyUSB0 belongs to (mine is 'dialout', although 
this didn't seem to work for me), or change permissions on the ttyUSB0 folder, 
although this may change once the computer is restarted/device unplugged

eg. chmod -R 777 /dev/ttyUSB0

I've found you need to give 7's (read, write, and execute) for it to work. But 
I am by no means an expert - if somebody has a better solution please feel free 
to correct me

Original comment by markzie...@gmail.com on 28 Nov 2012 at 6:05

GoogleCodeExporter commented 9 years ago
I experienced the following with Ubuntu 12.10 (and also with 12.04 LTS):

On my system the culprit was modem-manager blocking the serial port after 
plugging in my FTDI (USB virtual serial) device. I got the "Port busy" 
exception for ~ 30 seconds. Then the port was accessible again. After a 
"apt-get purge modemmanger" everything is fine now. The port is accessible 
immediately after plugging the device.

Original comment by friola...@googlemail.com on 28 Nov 2012 at 10:09

GoogleCodeExporter commented 9 years ago
In case the problem was with COM1 AKA /dev/ttyS0

Using chmod -R 777 /dev/ttyS0 only solves the problem until reboot, because the 
permissions will be reset. 

using  "ls -l /dev/ttyS0" I found out that the user group "dialout" has 
permissions on the "file", so I just added my user to that group and my problem 
was solved

Hope this helps

Original comment by ricardo....@gmail.com on 6 Feb 2013 at 8:29

GoogleCodeExporter commented 9 years ago
I've resolved this problem with:

chmod -R 777 /dev/ttyS0

Thanks :)

Original comment by calber...@gmail.com on 22 Feb 2013 at 2:47

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago
Hi every one, My name is Gopinath, i want connect weighbrige in ubuntu 10.04 
via the serial port. i want to read the weight using Java. please any one help 
me to do this.

Os: Ubuntu 10.04
Language : Java 1.7.0

Which library is easy to read, and how i can read the data, please assist me...

Thanks and Regards
Gopinath R

Original comment by rgop...@gmail.com on 1 May 2013 at 7:15