OESF | ELSI | pdaXrom | OpenZaurus | Zaurus Themes | Community Links | Ibiblio

IPB

Welcome Guest ( Log In | Register )

> How to access serial port from Java on the Zaurus?
jeff_burch
post May 28 2004, 03:36 PM
Post #1





Group: Members
Posts: 7
Joined: 26-May 04
Member No.: 3,454



Surely someone has done this before. I need to communicate from java to/from the Z's serial port.

========= installation ==============
I've installed http://s88074083.onlinehome.us/Zaurus/java...api_1.0_arm.ipk

This resulted in the following files in /home/QtPalmtop
java/comm.jar
java/jcl.jar
lib/libSerial.so
javax.comm.properties

Note that my LD_LIBRARY_PATH environmental variable is set to
/home/QtPalmtop/lib

I expect the calling sequence to be
SerialDemo --> comm.jar --> jcl.jar --> libSerial.so --> /dev/ttyS0

I manually performed the following configuration:

1) added user zaurus to the uucp line in /etc/group
2) chmod 777 /dev/ttyS0
3) chmod 777 /var

I got a font error and resolved it by adding this symbolic link:
mkdir -p /usr/local/qt-embedded/lib
cd /usr/local/qt-embedded/lib
ln -s /home/QtPalmtop/lib/fonts fonts

I built this demo
http://s88074083.onlinehome.us/Zaurus/java...-SerialDemo.zip

========== evm problems ============
With evm, I still get errors:

x=/home/QtPalmtop/java
evm -Dcomm.enable -cp .:$x/comm.jar:$x/jcl.jar SerialDemo
14 1082109100



RXTX WARNING: This library requires the user running applications to be in
group uucp. Please consult the INSTALL documentation. More information is
avaiable under the topic 'How can I use Lock Files with rxtx?'
check_lock_status: No permission to create lock file.


======= cvm problems ==========
With cvm, the application loads but I don't see any com ports:

cvm -Dcomm.enable -Djava.class.path=.:$x/comm.jar:$x/jcl.jar SerialDemo

========== Source code explorations =============
In the SerialDemo.java, search for

Enumeration en = CommPortIdentifier.getPortIdentifiers();

This appears to be returning an empty enumeration.

Note that I can rename the libSerial.so to a dummy name and the application DOES NOT complain. So, I don't think something is configured correctly.

If anyone knows what I'm doing wrong, please let me know!

Thanks in advance, Jeff
Go to the top of the page
 
+Quote Post
 
Start new topic
Replies (1 - 9)
jeff_burch
post May 28 2004, 04:13 PM
Post #2





Group: Members
Posts: 7
Joined: 26-May 04
Member No.: 3,454



I just discovered that if I leave off the jcl.jar from the path, evm will launch the application like cvm AND NOT give the RXTX lock error. Of course I get a class not found exception:

evm -cp .:$x/comm.jar SerialDemo
Caught java.lang.ClassNotFoundException: gnu/io/RXTXCommDriver while loading driver gnu.io.RXTXCommDriver

This is driven by the javax.comm.properties file. I can rename this file and get evm to run w/o ro without the jcl.jar. Of course nothing useful happens and I still don't have any comm ports listed...

The other interesting observation is that if I launch cvm w/o jcl.jar on the class path, cvm DOES NOT complain. So, it appears that cvm is not making the connection from comm.jar --> jcl.jar (as specified in the javax.comm.properties file).

So, it appears that cvm has larger problems than evm. I bet my evm problems are related to the following RXTX warning:

RXTX WARNING: This library requires the user running applications to be in
group uucp. Please consult the INSTALL documentation. More information is
avaiable under the topic 'How can I use Lock Files with rxtx?'
check_lock_status: No permission to create lock file.

please see: How can I use Lock Files with rxtx? in INSTALL

Note that if I rename libSerial.so to some dummy name, I now see this error with evm:

x=/home/QtPalmtop/java
evm -cp .:$x/comm.jar:$x/jcl.jar SerialDemo
Caught java.lang.UnsatisfiedLinkError: libSerial.so search
/home/QtPalmtop/bin/libSerial.so: cannot open shared object file: No such file or directory
/home/QtPalmtop/libSerial.so: cannot open shared object file: No such file or directory
/mnt/card/lib/libSerial.so: cannot open shared object file: No such file or directory
/home/QtPalmtop/lib/libSerial.so: cannot open shared object file: No such file or directory while loading driver gnu.io.RXTXCommDriver

So, the good new: it looks like evm is getting all the way to loading the shared library.
The bad new: it looks like cvm is having major problems going between comm.jar --> jcl.jar
Also, I still don't know how to resolve the lock problem...

Thanks in advance.

- Jeff
Go to the top of the page
 
+Quote Post
jeff_burch
post May 28 2004, 04:31 PM
Post #3





Group: Members
Posts: 7
Joined: 26-May 04
Member No.: 3,454



Yahoo, almost there for evm! I changed /etc/passwd and set the zaurus user to the group ID for uucp. Now I can see the ports! Got the receive side working. Now onto why I can't transmit...

I had added zaurus to the uucp line in /etc/group but it didn't appear to have any effect...

Still not sure about cvm...

- Jeff
Go to the top of the page
 
+Quote Post
ringsoft
post Aug 17 2004, 01:48 PM
Post #4





Group: Members
Posts: 1
Joined: 17-August 04
Member No.: 4,315



Seems like a lot of work ...

Our company provides the SerialPort API that runs on Zaurus, and 25+ other platforms. It's a simple matter to install our IPK, and write your application.
http://www.serialio.com/products/serialport/serialport.htm
This has been on the market for over 8 years (nearly 2 yrs before javax.comm) , and is the most widely used API for Java in the world.

We also provide a javax.comm interface if you prefer 'handcuff' your development to that API.
http://www.serialio.com/support/jspCommAPI.htm
Go to the top of the page
 
+Quote Post
totaln00b
post Sep 1 2004, 07:02 AM
Post #5





Group: Members
Posts: 104
Joined: 4-May 04
From: Lancaster, UK
Member No.: 3,142



Jeff_Burch,

How did you get on with this? I am having a similar problem trying to get a gps package to access my compact flash gps via the java comm api, and I got exactly the same rxtx error message about needing to be part of the uucp group.

When I tried the same approach as you, ie making changes to /etc/passwd and /etc/group and chmodding the /var/lock directory, every time I got the gid of the default user it still said it was 500, ie the qpe group, and I got the same error message. I'm quite new to all of this, so if there's something really simply that I'm missing I'd appreciate being told!

Thanks

Jo
Go to the top of the page
 
+Quote Post
guguseli
post May 3 2005, 11:32 PM
Post #6





Group: Members
Posts: 2
Joined: 2-May 05
Member No.: 7,046



Hi,

did it works for you now? I haave a similar problem...

but the serial interface works, as long I'm user and do some small nitty gritty programms. For me it looks like the Zaurus (Sharp Rom 860) doesn't supports propper group rights mad.gif

Did you came further?

Guguseli
Go to the top of the page
 
+Quote Post
Meanie
post May 4 2005, 03:27 AM
Post #7





Group: Members
Posts: 2,808
Joined: 21-March 05
From: Sydney, Australia
Member No.: 6,686



QUOTE(guguseli @ May 4 2005, 05:32 PM)
Hi,

did it works for you now? I haave a similar problem...

but the serial interface works, as long I'm user and do some small nitty gritty programms. For me it looks like the Zaurus (Sharp Rom 860) doesn't supports propper group rights  mad.gif

Did you came further?

Guguseli
*



did you guys try running the `chgrp` command to change the group membership of the zaurus user?

a user can be part of multiple groups, but by default is attached to a primary group. you can temporarily change the primary group by using the chgrp command
Go to the top of the page
 
+Quote Post
onlinejunkie
post Aug 1 2005, 03:55 AM
Post #8





Group: Members
Posts: 5
Joined: 27-July 05
Member No.: 7,702



QUOTE(Meanie @ May 4 2005, 01:27 PM)
QUOTE(guguseli @ May 4 2005, 05:32 PM)
Hi,

did it works for you now? I haave a similar problem...

but the serial interface works, as long I'm user and do some small nitty gritty programms. For me it looks like the Zaurus (Sharp Rom 860) doesn't supports propper group rights  mad.gif

Did you came further?

Guguseli
*



did you guys try running the `chgrp` command to change the group membership of the zaurus user?

a user can be part of multiple groups, but by default is attached to a primary group. you can temporarily change the primary group by using the chgrp command
*





Yes, its realy tricky, but you can use sodo and do the following:

Install sudo 1.6.x for on your device
copy javax.comm.properties and libSerial.so to the library directory of your preferred java vm.

for jeode libSerial.so goes to /home/QtPalmtop/lib,
for j2me to /home/QtPalmtop/j2me/lib
and for J9 to /home/QtPalmtop/j9/ppro10/lib

after that you have to create a startup script for your app like this:

#!/bin/sh
if [ $USER = 'root' ]; then
export QPEDIR=/home/QtPalmtop
export LD_LIBRARY_PATH=/home/QtPalmtop/lib
cd $QPEDIR/java
if [ -x /home/QtPalmtop/bin/evm ]; then
evm -XappName=$0 -cp nautik.jar:comm.jar:jcl.jar nautik.Menu
exit 0
elif [ -x $QPEDIR/j2me/bin/cvm ]; then
$QPEDIR/j2me/bin/cvm -XappName=$0 \
-Xbootclasspath/a:nautik.jar:comm.jar:jcl.jar \
nautik.Menu
exit 0
else
. /home/QtPalmtop/bin/installdir.sh
export IVEHOME=$QPEDIR/j9/ppro10
exec $IVEHOME/bin/startj9ppro -Dcom.ibm.oti.awt.FullScreenFrame=true - \
XappName=$0 -cp nautik.jar:jcl.jar:comm.jar nautik.Menu
exit 0
fi
else
sudo $0
fi
exit 1
Go to the top of the page
 
+Quote Post
onlinejunkie
post Aug 1 2005, 11:41 PM
Post #9





Group: Members
Posts: 5
Joined: 27-July 05
Member No.: 7,702



Yesterday I have tested the javacomm api with (Jeode, j2me and WEME J9) on my C1000 and a garmin GPS12 receiver.
I had success with a serialio cable originaly designed for the SL 5500 Port.
Let me say: It also works on the my C1000 with the "hidden" connector on the back. smile.gif
Go to the top of the page
 
+Quote Post
mazx
post Sep 11 2005, 01:20 PM
Post #10





Group: Members
Posts: 1
Joined: 11-September 05
Member No.: 8,081



Gentlement,

In addition to all the steps covered by Jeff Burch, try making /var/lock directory writable by everyone. This should remove problems with RXTX getting a lock error.

chmod 777 /var/lock

Andre S.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 28th August 2014 - 09:30 PM