ts-7000
[Top] [All Lists]

[ts-7000] Re: java recommendations

To:
Subject: [ts-7000] Re: java recommendations
From: "tedapt" <>
Date: Mon, 06 Aug 2007 03:15:36 -0000
Ugh! Editing the getty setup lines in /etc/inittab didn't fix it,
still cannot read on /dev/ttyAM0.  Anything else you had to do to
configure the port, like use stty to tweak the port settings or
something similar?

Are you also running Debian on a TS-7250 loaded from a USB drive? 
That adds a level of complexity for me, as I have to allow getty to
use /dev/ttyAM0 until I get Debian running or the script that enables
USB modules won't load (/usr/bin/loadUSBModules.sh), then I can kill
the getty process.  But I wonder if that script may somehow hang onto
the port?

--- In   wrote:
>
> yes, after the os boots you will no longer have com access.  If you  
> remove the jumpers on the board, jp2? It will prevent console on the  
> com during the boot.  You could just comment out com1 and send the  
> console stuff to com2.  I needed both so I had to ditch the console.
> 
> Justin
> Quoting tedapt <>:
> 
> > great! will give this a try in a few days when back on my system. Did
> > a quick search on /etc/inittab, from what I gather this contains
> > instructions for starting up the getty process to manage user logins
> > on the console via the serial port(?) If that's right, do you think
> > commenting it out will prevent use of the serial port for accessing
> > the board (handy when ethernet is unavailable)?
> >
> > --- In  justin@ wrote:
> >>
> >> Got it to work.  You have to disable the consol on the com ports.
> >> Look at your /etc/inittab.  Comment out any lines with the com
> > ports
> >> name in it.  I am using both ports so I commented out both: ttyAM0
> > and
> >> ttyAM1.
> >>
> >> Quoting tedapt <tedapt@>:
> >>
> >> > OK, I'll let you know whatever I find too. Won't be able to get
> > back
> >> > to this and retest for a few days though.  My test plan is to
> > write a
> >> > Java app that will listen for data on the serial port, and echo it
> >> > when received.
> >> >
> >> > One thing I've noticed is that if I try to start a listening app
> > on
> >> > the port it seems to lock the port at the OS level. I was then
> > unable
> >> > to access the port through the command line (e.g., echo
> >> >> /dev/ttyS0).  Wonder if this may be related to the read problem?
> > If
> >> > that's so, wonder if there's a way to share the port between
> > multiple
> >> > clients?
> >> >
> >> > --- In  justin@ wrote:
> >> >>
> >> >> Hey,
> >> >>
> >> >> Yeah, I am having a similar problem.  I can write just fine.  I
> > set
> >> > up
> >> >> a comm connection to the hyper term.  But I can't receive
> > anything
> >> >> back.  I'll let you know what I find.  I ended up building my own
> >> > rxtx
> >> >> lib, but same problem so I don't think thats the issue.
> >> >>
> >> >>
> >> >> Quoting tedapt <tedapt@>:
> >> >>
> >> >> > thanks Justin.  I seem to have had some limited success with
> > rxtx
> >> > 2.1
> >> >> > (the one you mention first) by simply creating a symlink
> >> >> > from /dev/ttyAMO to /dev/ttyS0 (ln -s /dev/ttyAM0 /dev/ttyS0).
> >> > Still
> >> >> > having problems communicating with a Modbus device, but
> > otherwise
> >> >> > Java is acting like it finds and can open the serial port (of
> >> > course
> >> >> > my "solution" may be part of the problem!)
> >> >> >
> >> >> > Current problem is that though my app claims to open
> > connections
> >> > and
> >> >> > make Modbus requests on /dev/ttyS0, I'm unable to get a
> > readable
> >> >> > response back (this code works properly on another platform).
> > I
> >> > need
> >> >> > to do some further testing with some simple Serial code to
> > prove
> >> > to
> >> >> > myself I can really write and read with the port properly.
> >> >> >
> >> >> > I'm wondering if I need to configure my serial port somehow
> > (not
> >> > very
> >> >> > experienced with serial ports, not sure if that's required or
> >> > takes
> >> >> > care of itself). My app sets connection params of 9600 baud, no
> >> >> > parity, 8 data bits, 1 stop bit.  Anyone know if the linux
> > system
> >> >> > (perhaps using stty) needs to configure the port to match this,
> >> > or is
> >> >> > it only the client app at the other end of the communication
> > that
> >> >> > needs to match the same parameters?
> >> >> >
> >> >> > Also, I'm using JamVM, so my RXTXcomm.jar was placed
> >> >> > in /usr/lib/jamvm (also where I placed librxtxSerial.so)
> >> >> >
> >> >> > Further, I was unable to enumerate the serial ports using rxtx
> >> > 2.0.
> >> >> > I would settle for a working rxtx 2.1 solution, and from the
> > rxtx
> >> >> > documentation it seems that rxtx 2.1 is the preferred solution
> >> > when
> >> >> > possible to use it (i.e., when have ability to import gnu.io
> >> > classes
> >> >> > instead of javax.comm).
> >> >> >
> >> >> > --- In  justin@ wrote:
> >> >> >>
> >> >> >> I am working on the same thing, didnt want to respond till I
> > an
> >> >> > answer
> >> >> >>
> >> >> >> You can download the most current version of the arm-unknown-
> >> > linux-
> >> >> > gnu
> >> >> >> binary at rxtx site:
> >> >> >> ftp://ftp.qbang.org/pub/rxtx/ToyBox/2.1-7-build1/Linux/glibc-
> >> >> > 2.3.5/arm-unknown-linux-gnu/
> >> >> >>
> >> >> >> The easyest way to add the ttyAMx com ports is to set the
> > system
> >> >> > properties:
> >> >> >> jamvm -Dgnu.io.rxtx.SerialPorts=/dev/ttyAM0:/dev/ttyAM1 foo
> >> >> >>
> >> >> >> The other way:
> >> >> >> RXTXCommDriver.java is
> >> >> >> available in ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-7pre2/src/
> >> >> > Download the
> >> >> >> RXTXCommDriver.java. In this code, you will find
> >> >> >>
> >> >> >> if (osName.equals ("Linux")) { String[]Temp = { "ttyS", //
> > linux
> >> >> > Serial
> >> >> >> Ports "ttySA" // for the IPAQs }; CandidatePortPrefixes =
> > Temp;
> >> >> >>
> >> >> >> Replace this code with
> >> >> >>
> >> >> >> if (osName.equals ("Linux")) { String[]Temp =
> >> >> > { "ttyS", "ttyAM",  // linux
> >> >> >> Serial Ports "ttySA" // for the IPAQs };
> > CandidatePortPrefixes =
> >> >> > Temp; }
> >> >> >>
> >> >> >> Compile the RXTXCommDriver.java and add the resulting
> >> >> > RXTXCommDriver.class
> >> >> >> file to RXTXcomm.jar
> >> >> > in /usr/java/jdk1.5.0_07/jre/lib/ext/RXTXcomm.jar
> >> >> >>
> >> >> >> Hope this help,
> >> >> >> Justin
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> Quoting tedapt <tedapt@>:
> >> >> >>
> >> >> >> > Can anyone clarify Dave's statement about the use of rxtx:
> >> >> >> >
> >> >> >> >    > note: you have to add the arm's /dev/ttyAMx to rxtx, it
> >> >> > doesn't
> >> >> >> > know about them
> >> >> >> >
> >> >> >> > Also, any notes from anyone who has successfully setup and
> > used
> >> >> > rxtx
> >> >> >> > with jamvm would be appreciated!
> >> >> >> >
> >> >> >> > The setup I'm attempting to get working is:
> >> >> >> >
> >> >> >> >    - TS-7250
> >> >> >> >    - debian on a USB thumbdrive
> >> >> >> >    - jamvm installed via apt-get
> >> >> >> >    - downloaded rxtx rxtx-2.0-7pre1 for Linux from:
> >> >> >> >       http://users.frii.com/jarvi/rxtx/download.html (file
> > at
> >> >> >> > ftp://ftp.qbang.org/pub/rxtx/rxtx-2.0-7pre1-i686-pc-linux-
> >> >> > gnu.tar.gz)
> >> >> >> >    - extracted librxtxSerial.so and placed it
> > in /usr/lib/jamvm
> >> >> >> >    - using Sun's comm.jar (from a Java 1.3 distribution)
> >> >> >> >
> >> >> >> > When I invoke the test class (source below) I get these
> >> > results:
> >> >> >> >
> >> >> >> >    root# /usr/bin/jamvm -cp .:comm.jar
> > SerialTest /dev/ttyAM0
> >> > 9600
> >> >> >> >    Specified serial port (/dev/ttyAM0) does not exist
> >> >> >> >    null
> >> >> >> >    javax.comm.NoSuchPortException
> >> >> >> >       at
> >> >> >> > javax.comm.CommPortIdentifier.getPortIdentifier
> >> >> > (CommPortIdentifier.java:105)
> >> >> >> >    at SerialTest.main(SerialTest.java:32)
> >> >> >> >
> >> >> >> > Here's source for SerialTest.java:
> >> >> >> >
> >> >> >> > import java.io.IOException;
> >> >> >> > import java.io.InputStream;
> >> >> >> > import java.io.OutputStream;
> >> >> >> > import java.util.Enumeration;
> >> >> >> >
> >> >> >> > import javax.comm.CommPortIdentifier;
> >> >> >> > import javax.comm.NoSuchPortException;
> >> >> >> > import javax.comm.PortInUseException;
> >> >> >> > import javax.comm.SerialPort;
> >> >> >> > import javax.comm.UnsupportedCommOperationException;
> >> >> >> >
> >> >> >> > public class SerialTest {
> >> >> >> >
> >> >> >> >    private static SerialPort sp;
> >> >> >> >    private static InputStream sin;
> >> >> >> >    private static OutputStream sout;
> >> >> >> >
> >> >> >> >    public static void main(String[] args) {
> >> >> >> >            try {
> >> >> >> >                    if (args.length != 2) {
> >> >> >> >                            System.out.println("Usage:
> > java
> >> >> > SerialTerm.tini port_name data_rate");
> >> >> >> >                            System.out.println("Available
> > ports
> >> >> > are:\n");
> >> >> >> >                            Enumeration ports =
> >> >> > CommPortIdentifier.getPortIdentifiers();
> >> >> >> >                            while(ports.hasMoreElements())
> > {
> >> >> >> >                                    System.out.println
> >> >> > (ports.nextElement() + "\n");
> >> >> >> >                            }
> >> >> >> >                            System.exit(1);
> >> >> >> >                    }
> >> >> >> >          String portName = args[0];
> >> >> >> >          int baudRate = Integer.parseInt(args[1]);
> >> >> >> >          try {
> >> >> >> >             sp =
> >> >> >> > (SerialPort)CommPortIdentifier.getPortIdentifier
> > (portName).open
> >> >> > ("SerialTerm",
> >> >> >> > 5000);
> >> >> >> >             sp.setSerialPortParams(baudRate,
> >> >> > SerialPort.DATABITS_8,
> >> >> >> >                                    SerialPort.STOPBITS_1,
> >> >> >> >                                    SerialPort.PARITY_NONE);
> >> >> >> >             sin = sp.getInputStream();
> >> >> >> >             sout = sp.getOutputStream();
> >> >> >> >          } catch (NoSuchPortException nsp) {
> >> >> >> >             System.out.println("Specified serial port
> >> > ("+portName+
> >> >> >> >                                ") does not exist");
> >> >> >> >             throw nsp;
> >> >> >> >          } catch (PortInUseException piu) {
> >> >> >> >             System.out.println("Serial port "+portName+
> >> >> >> >                                " in use by another
> >> > application");
> >> >> >> >             throw piu;
> >> >> >> >          } catch (UnsupportedCommOperationException usc) {
> >> >> >> >             System.out.println("Unable to configure
> >> >> > port:"+portName);
> >> >> >> >             throw usc;
> >> >> >> >          } catch (IOException ioe) {
> >> >> >> >             System.out.println(
> >> >> >> >                                "Unable to acquire I/O
> > streams
> >> > for
> >> >> > port
> >> >> >> > " + portName);
> >> >> >> >             throw ioe;
> >> >> >> >          }
> >> >> >> >            } catch (Exception e) {
> >> >> >> >                    System.out.println(e.getMessage());
> >> >> >> >                    e.printStackTrace();
> >> >> >> >            }
> >> >> >> >    }
> >> >> >> >
> >> >> >> > }
> >> >> >> >
> >> >> >> > --- In  Dave Cramer <davec@> wrote:
> >> >> >> >>
> >> >> >> >> I've been running jamvm on mine for quite a while. You
> > don't
> >> > need
> >> >> >> >> jikes, unless you plan to compile on the arm (Very slow)
> >> >> >> >> I pulled alot of the gnuclasspath out, and the whole thing
> > is
> >> >> > quite
> >> >> >> >> small. Around 4M or so
> >> >> >> >>
> >> >> >> >> you need rxtx for serial port work with java,, other than
> > that
> >> >> > it's
> >> >> >> >> write once deploy everywhere
> >> >> >> >>
> >> >> >> >> note: you have to add the arm's /dev/ttyAMx to rxtx, it
> >> > doesn't
> >> >> > know
> >> >> >> >> about them
> >> >> >> >>
> >> >> >> >> Dave
> >> >> >> >> On 7-Nov-06, at 8:57 PM, gunghoiguana wrote:
> >> >> >> >>
> >> >> >> >> > The install was much easier than I anticipated:
> >> >> >> >> >
> >> >> >> >> > apt-get install jikes
> >> >> >> >> > apt-get install jamvm
> >> >> >> >> > apt-get install jikes-classpath
> >> >> >> >> >
> >> >> >> >> > Everything seems to work fine, and I can run class files
> >> > that I
> >> >> >> >> > compiled on my desktop PC. I've only checked out basic
> >> >> > functions and
> >> >> >> >> > console IO so far, but I'll be checking out the serial
> > port
> >> > and
> >> >> >> >> > network interfaces soon. Java is *supposed* to make those
> >> >> > things
> >> >> >> >> > easy...
> >> >> >> >> >
> >> >> >> >> > Brian
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >> >
> >> >> >> >>
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >>
> >> >> >
> >> >> >
> >> >> >
> >> >>
> >> >
> >> >
> >> >
> >>
> >
> >
> >
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ts-7000/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/ts-7000/join
    (Yahoo! ID required)

<*> To change settings via email:
     
    

<*> To unsubscribe from this group, send an email to:
    

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

<Prev in Thread] Current Thread [Next in Thread>
Admin

Disclaimer: Neither Andrew Taylor nor the University of NSW School of Computer and Engineering take any responsibility for the contents of this archive. It is purely a compilation of material sent by many people to the birding-aus mailing list. It has not been checked for accuracy nor its content verified in any way. If you wish to get material removed from the archive or have other queries about the archive e-mail Andrew Taylor at this address: andrewt@cse.unsw.EDU.AU