Fazecast / jSerialComm

Platform-independent serial port access for Java
GNU Lesser General Public License v3.0
1.35k stars 287 forks source link

Unable to open /dev/ttyAMA0 with non-root user #256

Closed dzappold closed 4 years ago

dzappold commented 5 years ago

Observation: The SerialPort.openPort() function returns always false as non-root user. With root, we can open the port.

The troubleshooting page did not help.

Another observation we made: The descriptive port name changes, when the program is started as root or non-root user:

pi:~ $ sudo java -jar SerialTester.jar 
DescriptivePortName: Physical Port AMA0
SystemPortName: ttyAMA0
Try to open port: true

vs

pi:~ $ java -jar SerialTester.jar 
DescriptivePortName: USB-Based Serial Port
SystemPortName: ttyAMA0
Try to open port: false

Any help or ideas are appreciated.

hedgecrw commented 5 years ago

This is definitely still a permissions issue on the ttyAMA0 serial port file. Try the suggestions listed here and see if any of these work for you: https://www.raspberrypi.org/forums/viewtopic.php?t=180254

If you find something that works, let me know and I'll add it to the troubleshooting page as an additional suggestion. Thanks!

dzappold commented 5 years ago

Thanks for your response, sadly this didn't worked for us.

We are still working on this. In case we have some progress we will share it. Even cat /dev/ttyAMA0 is only working with sudo.

Any other help or ideas appreciated.

Sapozhko commented 4 years ago

@dzappold have you tried this? sudo groupadd plugdev sudo groupadd dialout sudo usermod -a -G tty $1 sudo usermod -a -G dialout $1 sudo usermod -a -G uucp $1 sudo usermod -a -G plugdev $1 $1 is username

hedgecrw commented 4 years ago

Closing due to not a jSerialComm bug. Please do comment back if you resolve this permissions issue, and I will update the troubleshooting page in case others experience the same issue.