serial ports in librxtx-java

Asked by Melvin G. Seyle, Jr. on 2017-11-24

At present librxtx-java handles standard linux serial and USB port names. I have a Perle dual serial port card. The ports are /dev/ttyPS0 and /dev/ttyPS1. My java program uses librxtx-java and thus cannot use the Perle port or any other non standard named port. Is it possible to change librxtx-java to handle any legitimate serial port?

Thank you.

Mel Seyle
<email address hidden>

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu rxtx Edit question
Assignee:
No assignee Edit question
Solved by:
Melvin G. Seyle, Jr.
Solved:
2017-12-31
Last query:
2017-12-31
Last reply:
2017-12-31

What is the output:

ls -la /dev/ttyPS0 /dev/ttyPS1

Thanks

Launchpad Janitor (janitor) said : #2

This question was expired because it remained in the 'Needs information' state without activity for the last 15 days.

On 12/10/2017 03:38 AM, Launchpad Janitor wrote:
> Your question #661054 on rxtx in Ubuntu changed:
> https://answers.launchpad.net/ubuntu/+source/rxtx/+question/661054
>
> Status: Needs information => Expired
>
> Launchpad Janitor expired the question:
> This question was expired because it remained in the 'Needs information'
> state without activity for the last 15 days.
>
I have the information requested, and would like to reply, but cannot
figure out how to do so.  You can call me dumb, but I do not see the
reply mechanism on that page.

I am VERY interested in getting my question resolved, and will immediately
reply as soon as I know how.

Thanks for your time

Mel Seyle

Here is the additional information requested for question #661054 on rxtx in Ubuntu:

ls -la /dev/ttyPS0
crw-rw---- 1 root dialout 164, 0 Dec 16 10:06 /dev/ttyPS0
ls -la /dev/ttyPS1
crw-rw---- 1 root dialout 164, 1 Dec 16 10:06 /dev/ttyPS1

Melvin G. Seyle, Jr. (flash5440)

Manfred Hampl (m-hampl) said : #5

What is the output of the commands

ls -ld /dev/tty*
groups

 ls -ld /dev/tty*
crw-rw-rw- 1 root tty 5, 0 Dec 22 21:37 /dev/tty
crw--w---- 1 root tty 4, 0 Dec 22 10:45 /dev/tty0
crw-rw---- 1 root tty 4, 1 Dec 22 10:45 /dev/tty1
crw--w---- 1 root tty 4, 10 Dec 22 10:45 /dev/tty10
crw--w---- 1 root tty 4, 11 Dec 22 10:45 /dev/tty11
crw--w---- 1 root tty 4, 12 Dec 22 10:45 /dev/tty12
crw--w---- 1 root tty 4, 13 Dec 22 10:45 /dev/tty13
crw--w---- 1 root tty 4, 14 Dec 22 10:45 /dev/tty14
crw--w---- 1 root tty 4, 15 Dec 22 10:45 /dev/tty15
crw--w---- 1 root tty 4, 16 Dec 22 10:45 /dev/tty16
crw--w---- 1 root tty 4, 17 Dec 22 10:45 /dev/tty17
crw--w---- 1 root tty 4, 18 Dec 22 10:45 /dev/tty18
crw--w---- 1 root tty 4, 19 Dec 22 10:45 /dev/tty19
crw-rw---- 1 root tty 4, 2 Dec 22 10:45 /dev/tty2
crw--w---- 1 root tty 4, 20 Dec 22 10:45 /dev/tty20
crw--w---- 1 root tty 4, 21 Dec 22 10:45 /dev/tty21
crw--w---- 1 root tty 4, 22 Dec 22 10:45 /dev/tty22
crw--w---- 1 root tty 4, 23 Dec 22 10:45 /dev/tty23
crw--w---- 1 root tty 4, 24 Dec 22 10:45 /dev/tty24
crw--w---- 1 root tty 4, 25 Dec 22 10:45 /dev/tty25
crw--w---- 1 root tty 4, 26 Dec 22 10:45 /dev/tty26
crw--w---- 1 root tty 4, 27 Dec 22 10:45 /dev/tty27
crw--w---- 1 root tty 4, 28 Dec 22 10:45 /dev/tty28
crw--w---- 1 root tty 4, 29 Dec 22 10:45 /dev/tty29
crw-rw---- 1 root tty 4, 3 Dec 22 10:45 /dev/tty3
crw--w---- 1 root tty 4, 30 Dec 22 10:45 /dev/tty30
crw--w---- 1 root tty 4, 31 Dec 22 10:45 /dev/tty31
crw--w---- 1 root tty 4, 32 Dec 22 10:45 /dev/tty32
crw--w---- 1 root tty 4, 33 Dec 22 10:45 /dev/tty33
crw--w---- 1 root tty 4, 34 Dec 22 10:45 /dev/tty34
crw--w---- 1 root tty 4, 35 Dec 22 10:45 /dev/tty35
crw--w---- 1 root tty 4, 36 Dec 22 10:45 /dev/tty36
crw--w---- 1 root tty 4, 37 Dec 22 10:45 /dev/tty37
crw--w---- 1 root tty 4, 38 Dec 22 10:45 /dev/tty38
crw--w---- 1 root tty 4, 39 Dec 22 10:45 /dev/tty39
crw-rw---- 1 root tty 4, 4 Dec 22 10:45 /dev/tty4
crw--w---- 1 root tty 4, 40 Dec 22 10:45 /dev/tty40
crw--w---- 1 root tty 4, 41 Dec 22 10:45 /dev/tty41
crw--w---- 1 root tty 4, 42 Dec 22 10:45 /dev/tty42
crw--w---- 1 root tty 4, 43 Dec 22 10:45 /dev/tty43
crw--w---- 1 root tty 4, 44 Dec 22 10:45 /dev/tty44
crw--w---- 1 root tty 4, 45 Dec 22 10:45 /dev/tty45
crw--w---- 1 root tty 4, 46 Dec 22 10:45 /dev/tty46
crw--w---- 1 root tty 4, 47 Dec 22 10:45 /dev/tty47
crw--w---- 1 root tty 4, 48 Dec 22 10:45 /dev/tty48
crw--w---- 1 root tty 4, 49 Dec 22 10:45 /dev/tty49
crw-rw---- 1 root tty 4, 5 Dec 22 10:45 /dev/tty5
crw--w---- 1 root tty 4, 50 Dec 22 10:45 /dev/tty50
crw--w---- 1 root tty 4, 51 Dec 22 10:45 /dev/tty51
crw--w---- 1 root tty 4, 52 Dec 22 10:45 /dev/tty52
crw--w---- 1 root tty 4, 53 Dec 22 10:45 /dev/tty53
crw--w---- 1 root tty 4, 54 Dec 22 10:45 /dev/tty54
crw--w---- 1 root tty 4, 55 Dec 22 10:45 /dev/tty55
crw--w---- 1 root tty 4, 56 Dec 22 10:45 /dev/tty56
crw--w---- 1 root tty 4, 57 Dec 22 10:45 /dev/tty57
crw--w---- 1 root tty 4, 58 Dec 22 10:45 /dev/tty58
crw--w---- 1 root tty 4, 59 Dec 22 10:45 /dev/tty59
crw-rw---- 1 root tty 4, 6 Dec 22 10:45 /dev/tty6
crw--w---- 1 root tty 4, 60 Dec 22 10:45 /dev/tty60
crw--w---- 1 root tty 4, 61 Dec 22 10:45 /dev/tty61
crw--w---- 1 root tty 4, 62 Dec 22 10:45 /dev/tty62
crw--w---- 1 root tty 4, 63 Dec 22 10:45 /dev/tty63
crw--w---- 1 root tty 4, 7 Dec 22 10:45 /dev/tty7
crw--w---- 1 root tty 4, 8 Dec 22 10:45 /dev/tty8
crw--w---- 1 root tty 4, 9 Dec 22 10:45 /dev/tty9
crw------- 1 root root 5, 3 Dec 22 10:45 /dev/ttyprintk
crw-rw---- 1 root dialout 164, 0 Dec 22 21:44 /dev/ttyPS0
crw-rw---- 1 root dialout 164, 1 Dec 22 21:44 /dev/ttyPS1
crw-rw---- 1 root dialout 164, 10 Dec 22 21:44 /dev/ttyPS10
crw-rw---- 1 root dialout 164, 11 Dec 22 21:44 /dev/ttyPS11
crw-rw---- 1 root dialout 164, 12 Dec 22 21:44 /dev/ttyPS12
crw-rw---- 1 root dialout 164, 13 Dec 22 21:44 /dev/ttyPS13
crw-rw---- 1 root dialout 164, 14 Dec 22 21:44 /dev/ttyPS14
crw-rw---- 1 root dialout 164, 15 Dec 22 21:44 /dev/ttyPS15
crw-rw---- 1 root dialout 164, 16 Dec 22 21:44 /dev/ttyPS16
crw-rw---- 1 root dialout 164, 17 Dec 22 21:44 /dev/ttyPS17
crw-rw---- 1 root dialout 164, 18 Dec 22 21:44 /dev/ttyPS18
crw-rw---- 1 root dialout 164, 19 Dec 22 21:44 /dev/ttyPS19
crw-rw---- 1 root dialout 164, 2 Dec 22 21:44 /dev/ttyPS2
crw-rw---- 1 root dialout 164, 20 Dec 22 21:44 /dev/ttyPS20
crw-rw---- 1 root dialout 164, 21 Dec 22 21:44 /dev/ttyPS21
crw-rw---- 1 root dialout 164, 22 Dec 22 21:44 /dev/ttyPS22
crw-rw---- 1 root dialout 164, 23 Dec 22 21:44 /dev/ttyPS23
crw-rw---- 1 root dialout 164, 24 Dec 22 21:44 /dev/ttyPS24
crw-rw---- 1 root dialout 164, 25 Dec 22 21:44 /dev/ttyPS25
crw-rw---- 1 root dialout 164, 26 Dec 22 21:44 /dev/ttyPS26
crw-rw---- 1 root dialout 164, 27 Dec 22 21:44 /dev/ttyPS27
crw-rw---- 1 root dialout 164, 28 Dec 22 21:44 /dev/ttyPS28
crw-rw---- 1 root dialout 164, 29 Dec 22 21:44 /dev/ttyPS29
crw-rw---- 1 root dialout 164, 3 Dec 22 21:44 /dev/ttyPS3
crw-rw---- 1 root dialout 164, 30 Dec 22 21:44 /dev/ttyPS30
crw-rw---- 1 root dialout 164, 31 Dec 22 21:44 /dev/ttyPS31
crw-rw---- 1 root dialout 164, 32 Dec 22 21:44 /dev/ttyPS32
crw-rw---- 1 root dialout 164, 33 Dec 22 21:44 /dev/ttyPS33
crw-rw---- 1 root dialout 164, 34 Dec 22 21:44 /dev/ttyPS34
crw-rw---- 1 root dialout 164, 35 Dec 22 21:44 /dev/ttyPS35
crw-rw---- 1 root dialout 164, 36 Dec 22 21:44 /dev/ttyPS36
crw-rw---- 1 root dialout 164, 37 Dec 22 21:44 /dev/ttyPS37
crw-rw---- 1 root dialout 164, 38 Dec 22 21:44 /dev/ttyPS38
crw-rw---- 1 root dialout 164, 39 Dec 22 21:44 /dev/ttyPS39
crw-rw---- 1 root dialout 164, 4 Dec 22 21:44 /dev/ttyPS4
crw-rw---- 1 root dialout 164, 40 Dec 22 21:44 /dev/ttyPS40
crw-rw---- 1 root dialout 164, 41 Dec 22 21:44 /dev/ttyPS41
crw-rw---- 1 root dialout 164, 42 Dec 22 21:44 /dev/ttyPS42
crw-rw---- 1 root dialout 164, 43 Dec 22 21:44 /dev/ttyPS43
crw-rw---- 1 root dialout 164, 44 Dec 22 21:44 /dev/ttyPS44
crw-rw---- 1 root dialout 164, 45 Dec 22 21:44 /dev/ttyPS45
crw-rw---- 1 root dialout 164, 46 Dec 22 21:44 /dev/ttyPS46
crw-rw---- 1 root dialout 164, 47 Dec 22 21:44 /dev/ttyPS47
crw-rw---- 1 root dialout 164, 48 Dec 22 21:44 /dev/ttyPS48
crw-rw---- 1 root dialout 164, 49 Dec 22 21:44 /dev/ttyPS49
crw-rw---- 1 root dialout 164, 5 Dec 22 21:44 /dev/ttyPS5
crw-rw---- 1 root dialout 164, 50 Dec 22 21:44 /dev/ttyPS50
crw-rw---- 1 root dialout 164, 51 Dec 22 21:44 /dev/ttyPS51
crw-rw---- 1 root dialout 164, 52 Dec 22 21:44 /dev/ttyPS52
crw-rw---- 1 root dialout 164, 53 Dec 22 21:44 /dev/ttyPS53
crw-rw---- 1 root dialout 164, 54 Dec 22 21:44 /dev/ttyPS54
crw-rw---- 1 root dialout 164, 55 Dec 22 21:44 /dev/ttyPS55
crw-rw---- 1 root dialout 164, 56 Dec 22 21:44 /dev/ttyPS56
crw-rw---- 1 root dialout 164, 57 Dec 22 21:44 /dev/ttyPS57
crw-rw---- 1 root dialout 164, 58 Dec 22 21:44 /dev/ttyPS58
crw-rw---- 1 root dialout 164, 59 Dec 22 21:44 /dev/ttyPS59
crw-rw---- 1 root dialout 164, 6 Dec 22 21:44 /dev/ttyPS6
crw-rw---- 1 root dialout 164, 60 Dec 22 21:44 /dev/ttyPS60
crw-rw---- 1 root dialout 164, 61 Dec 22 21:44 /dev/ttyPS61
crw-rw---- 1 root dialout 164, 62 Dec 22 21:44 /dev/ttyPS62
crw-rw---- 1 root dialout 164, 63 Dec 22 21:44 /dev/ttyPS63
crw-rw---- 1 root dialout 164, 7 Dec 22 21:44 /dev/ttyPS7
crw-rw---- 1 root dialout 164, 8 Dec 22 21:44 /dev/ttyPS8
crw-rw---- 1 root dialout 164, 9 Dec 22 21:44 /dev/ttyPS9
crw-rw---- 1 root dialout 4, 64 Dec 22 10:45 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 Dec 22 10:45 /dev/ttyS1
crw-rw---- 1 root dialout 4, 74 Dec 22 10:45 /dev/ttyS10
crw-rw---- 1 root dialout 4, 75 Dec 22 10:45 /dev/ttyS11
crw-rw---- 1 root dialout 4, 76 Dec 22 10:45 /dev/ttyS12
crw-rw---- 1 root dialout 4, 77 Dec 22 10:45 /dev/ttyS13
crw-rw---- 1 root dialout 4, 78 Dec 22 10:45 /dev/ttyS14
crw-rw---- 1 root dialout 4, 79 Dec 22 10:45 /dev/ttyS15
crw-rw---- 1 root dialout 4, 80 Dec 22 10:45 /dev/ttyS16
crw-rw---- 1 root dialout 4, 81 Dec 22 10:45 /dev/ttyS17
crw-rw---- 1 root dialout 4, 82 Dec 22 10:45 /dev/ttyS18
crw-rw---- 1 root dialout 4, 83 Dec 22 10:45 /dev/ttyS19
crw-rw---- 1 root dialout 4, 66 Dec 22 10:45 /dev/ttyS2
crw-rw---- 1 root dialout 4, 84 Dec 22 10:45 /dev/ttyS20
crw-rw---- 1 root dialout 4, 85 Dec 22 10:45 /dev/ttyS21
crw-rw---- 1 root dialout 4, 86 Dec 22 10:45 /dev/ttyS22
crw-rw---- 1 root dialout 4, 87 Dec 22 10:45 /dev/ttyS23
crw-rw---- 1 root dialout 4, 88 Dec 22 10:45 /dev/ttyS24
crw-rw---- 1 root dialout 4, 89 Dec 22 10:45 /dev/ttyS25
crw-rw---- 1 root dialout 4, 90 Dec 22 10:45 /dev/ttyS26
crw-rw---- 1 root dialout 4, 91 Dec 22 10:45 /dev/ttyS27
crw-rw---- 1 root dialout 4, 92 Dec 22 10:45 /dev/ttyS28
crw-rw---- 1 root dialout 4, 93 Dec 22 10:45 /dev/ttyS29
crw-rw---- 1 root dialout 4, 67 Dec 22 10:45 /dev/ttyS3
crw-rw---- 1 root dialout 4, 94 Dec 22 10:45 /dev/ttyS30
crw-rw---- 1 root dialout 4, 95 Dec 22 10:45 /dev/ttyS31
crw-rw---- 1 root dialout 4, 68 Dec 22 10:45 /dev/ttyS4
crw-rw---- 1 root dialout 4, 69 Dec 22 10:45 /dev/ttyS5
crw-rw---- 1 root dialout 4, 70 Dec 22 10:45 /dev/ttyS6
crw-rw---- 1 root dialout 4, 71 Dec 22 10:45 /dev/ttyS7
crw-rw---- 1 root dialout 4, 72 Dec 22 10:45 /dev/ttyS8
crw-rw---- 1 root dialout 4, 73 Dec 22 10:45 /dev/ttyS9
crw-rw---- 1 root dialout 188, 0 Dec 22 10:45 /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 1 Dec 22 21:47 /dev/ttyUSB1

groups
mseyle adm tty uucp dialout cdrom sudo dip plugdev lpadmin sambashare vboxusers

Manfred Hampl (m-hampl) said : #7

You are member of the dialout group, so I assume that it is not a file access rights problem.

Maybe you can trick the system by creating a symbolic link with the right name, something like

ln -s /dev/ttyPS0 /dev/ttyS32

Manfred,

In my s/w the user must enter their chosen port, /dev/ttyS32, into a configuration file.
The s/w picks up this entry and and passes it to getPortIdentifier. At this point the library
could either just return the PortIdentifier of /dev/ttyS32 or realize that /dev/ttyS32 is
a link and return the PortIdentifier of /dev/ttyPS0.

I think the question is whether the library recognizes that /dev/ttyS32 is a link.

It will take me a while to reconfigure my connection to /dev/PS0 before I can try
your recommendation. We have company coming in from out of town today. I'll
try to get this done before my question runs out of time again, and get back to you..

I appreciate your interest and suggestion

Manfred Hampl (m-hampl) said : #9

I just found another proposal in
https://www.raspberrypi.org/forums/viewtopic.php?f=81&t=32186#p277865

Just add this line on the top of your code:
System.setProperty("gnu.io.rxtx.SerialPorts", PORT_NAME);

If I understand the docu correctly, PORT_NAME can be a list like "/dev/ttyPS0:/dev/ttyPS1:"

Ok, the recommendation that I use

ln -s /dev/ttyPS0 /dev/ttyS32

worked just fine. If I stick with this method I'll have to write a udev rule, since the link goes away on reboot, but
that's no problem.

The second method recommended looks interesting, and I'm going to try that also.

I'll report back on the results of the second method, and will then close this problem.

Thanks for the continued help!

Add it to your startup. If systemd has an equivalent of /etc/rc.local then add it to that file (above the 'exit 0' line in rc.local)

It will run each boot and make the file for you

Putting it in a file that's executed at startup also sounds like a good option!

I think that with three ways to get things done I'll thank everyone who helped and call
this problem solved!

Thanks, everyone, for all your help!

HAPPY NEW YEAR!!!!!