[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: serial port io

On Tue, Mar 14, 2000 at 04:38:57PM +0000, brad gray wrote:
> does anyone know how to open a serial port in java ?
> i realize that there is a javax.comm package,  but no linux port...
> just wondering if anyone has done this before i start learing some
> JPython, etc...

 Well, using the beauty or the Unix device paradigm, you can open /dev/ttyS1
to do IO to the serial port.  (S0 is DOS COM1, S1 is DOS COM2, etc.)

 I don't know if you can do ioctl()s on it from java, so you might have to
do something ugly like system( "stty crtscts 115200 < /dev/ttyS1" );  to
change the serial port setting from java.  (system() is C, but there's a
java equivalent somewhere.  System.run() or something?)

#define X(x,y) x##y
DUPS Secretary ; http://is2.dal.ca/~dups/
Peter Cordes ;  e-mail: X(peter@cordes.phys. , dal.ca)

"The gods confound the man who first found out how to distinguish the hours!
 Confound him, too, who in this place set up a sundial, to cut and hack
 my day so wretchedly into small pieces!" -- Plautus, 200 BCE

Reply to: