Author Topic: How to access serial port from Java on the Zaurus?  (Read 16830 times)

jeff_burch

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • http://
How to access serial port from Java on the Zaurus?
« on: May 28, 2004, 07:36:02 pm »
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

jeff_burch

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • http://
How to access serial port from Java on the Zaurus?
« Reply #1 on: May 28, 2004, 08:13:04 pm »
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

jeff_burch

  • Newbie
  • *
  • Posts: 7
    • View Profile
    • http://
How to access serial port from Java on the Zaurus?
« Reply #2 on: May 28, 2004, 08:31:05 pm »
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

ringsoft

  • Newbie
  • *
  • Posts: 1
    • View Profile
How to access serial port from Java on the Zaurus?
« Reply #3 on: August 17, 2004, 05:48:50 pm »
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

totaln00b

  • Full Member
  • ***
  • Posts: 104
    • View Profile
How to access serial port from Java on the Zaurus?
« Reply #4 on: September 01, 2004, 11:02:11 am »
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
CL 860, cacko  1.23 full, Sandisk 512Mb CF, Kodak 256Mb SD, Symbol Spectrum24 wifi
SL 5500, standard rom, 256Mb SD, CF GPS

guguseli

  • Newbie
  • *
  • Posts: 2
    • View Profile
How to access serial port from Java on the Zaurus?
« Reply #5 on: May 04, 2005, 03:32:55 am »
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  

Did you came further?

Guguseli

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
How to access serial port from Java on the Zaurus?
« Reply #6 on: May 04, 2005, 07:27:28 am »
Quote
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   

Did you came further?

Guguseli
[div align=\"right\"][a href=\"index.php?act=findpost&pid=78147\"][{POST_SNAPBACK}][/a][/div]


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
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

onlinejunkie

  • Newbie
  • *
  • Posts: 5
    • View Profile
How to access serial port from Java on the Zaurus?
« Reply #7 on: August 01, 2005, 07:55:08 am »
Quote
Quote
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   

Did you came further?

Guguseli
[div align=\"right\"][a href=\"index.php?act=findpost&pid=78147\"][{POST_SNAPBACK}][/a][/div]


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
[div align=\"right\"][a href=\"index.php?act=findpost&pid=78177\"][{POST_SNAPBACK}][/a][/div]



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
« Last Edit: August 02, 2005, 03:51:37 am by onlinejunkie »
- until then ....

Kurt


[span style=\'font-size:8pt;line-height:100%\'] C1000 with free j2me, Sharp ROM, CFII Seagate ST1 5GB, SD Lexar 1GB, serialio cable, WLAN Linksys WCF12 [/span]

onlinejunkie

  • Newbie
  • *
  • Posts: 5
    • View Profile
How to access serial port from Java on the Zaurus?
« Reply #8 on: August 02, 2005, 03:41:18 am »
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.  
« Last Edit: August 02, 2005, 03:52:53 am by onlinejunkie »
- until then ....

Kurt


[span style=\'font-size:8pt;line-height:100%\'] C1000 with free j2me, Sharp ROM, CFII Seagate ST1 5GB, SD Lexar 1GB, serialio cable, WLAN Linksys WCF12 [/span]

mazx

  • Newbie
  • *
  • Posts: 1
    • View Profile
How to access serial port from Java on the Zaurus?
« Reply #9 on: September 11, 2005, 05:20:08 pm »
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.